function A(A, e, o) {
    return e in A ? Object.defineProperty(A, e, {
        value: o,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : A[e] = o, A;
}

module.exports = function() {
    var e = {}, o = {
        login: function(A, e, o) {},
        syncMsgs: function(A, e) {},
        getC2CHistoryMsgs: function(A, e, o) {},
        syncGroupMsgs: function(A, e, o) {},
        sendMsg: function(A, e, o) {},
        logout: function(A, e) {},
        setAutoRead: function(A, e, o) {},
        getProfilePortrait: function(A, e, o) {},
        setProfilePortrait: function(A, e, o) {},
        applyAddFriend: function(A, e, o) {},
        getPendency: function(A, e, o) {},
        deletePendency: function(A, e, o) {},
        responseFriend: function(A, e, o) {},
        getAllFriend: function(A, e, o) {},
        deleteFriend: function(A, e, o) {},
        addBlackList: function(A, e, o) {},
        getBlackList: function(A, e, o) {},
        deleteBlackList: function(A, e, o) {},
        uploadPic: function(A, e, o) {},
        createGroup: function(A, e, o) {},
        applyJoinGroup: function(A, e, o) {},
        handleApplyJoinGroup: function(A, e, o) {},
        deleteApplyJoinGroupPendency: function(A, e, o) {},
        quitGroup: function(A, e, o) {},
        getGroupPublicInfo: function(A, e, o) {},
        getGroupInfo: function(A, e, o) {},
        modifyGroupBaseInfo: function(A, e, o) {},
        destroyGroup: function(A, e, o) {},
        getJoinedGroupListHigh: function(A, e, o) {},
        getGroupMemberInfo: function(A, e, o) {},
        addGroupMember: function(A, e, o) {},
        modifyGroupMember: function(A, e, o) {},
        forbidSendMsg: function(A, e, o) {},
        deleteGroupMember: function(A, e, o) {},
        getPendencyGroup: function(A, e, o) {},
        getPendencyReport: function(A, e, o) {},
        getPendencyGroupRead: function(A, e, o) {},
        sendCustomGroupNotify: function(A, e, o) {},
        Msg: function(A, e, o, i, C, g, E, I) {},
        MsgStore: {
            sessMap: function() {
                return {};
            },
            sessCount: function() {
                return 0;
            },
            sessByTypeId: function(A, e) {
                return {};
            },
            delSessByTypeId: function(A, e) {
                return !0;
            },
            resetCookieAndSyncFlag: function() {},
            downloadMap: {}
        }
    };
    return function(o) {
        var i = {
            VERSION: "1.7.0",
            APPID: "537048168",
            PLAATFORM: "10"
        }, C = !0, g = {
            FORMAL: {
                COMMON: "https://webim.tim.qq.com",
                PIC: "https://pic.tim.qq.com"
            },
            TEST: {
                COMMON: "https://test.tim.qq.com",
                PIC: "https://pic.tim.qq.com"
            }
        }, E = {}, I = {
            OPEN_IM: "openim",
            GROUP: "group_open_http_svc",
            FRIEND: "sns",
            PROFILE: "profile",
            RECENT_CONTACT: "recentcontact",
            PIC: "openpic",
            BIG_GROUP: "group_open_http_noauth_svc",
            BIG_GROUP_LONG_POLLING: "group_open_long_polling_http_noauth_svc",
            IM_OPEN_STAT: "imopenstat",
            DEL_CHAT: "recentcontact"
        }, n = A({
            openim: "v4",
            group_open_http_svc: "v4",
            sns: "v4",
            profile: "v4",
            recentcontact: "v4",
            openpic: "v4",
            group_open_http_noauth_svc: "v1",
            group_open_long_polling_http_noauth_svc: "v1",
            imopenstat: "v4"
        }, "recentcontact", "v4"), t = {
            login: 1,
            pic_up: 3,
            apply_join_group: 9,
            create_group: 10,
            longpolling: 18,
            send_group_msg: 19,
            sendmsg: 20
        }, Q = {
            C2C: "C2C",
            GROUP: "GROUP"
        }, B = {
            C2C: 1,
            GROUP: 2
        }, s = {
            C2C: 12e3,
            GROUP: 8898
        }, M = {
            OK: "OK",
            FAIL: "FAIL"
        }, w = {
            TEXT: "TIMTextElem",
            FACE: "TIMFaceElem",
            IMAGE: "TIMImageElem",
            CUSTOM: "TIMCustomElem",
            SOUND: "TIMSoundElem",
            FILE: "TIMFileElem",
            LOCATION: "TIMLocationElem",
            GROUP_TIP: "TIMGroupTipElem"
        }, r = {
            ORIGIN: 1,
            LARGE: 2,
            SMALL: 3
        }, D = {
            JPG: 1,
            JPEG: 1,
            GIF: 2,
            PNG: 3,
            BMP: 4,
            UNKNOWN: 255
        }, f = {
            RAW_DATA: 0,
            BASE64_DATA: 1
        }, c = {
            BUSSINESS_ID: "10001",
            AUTH_KEY: "617574686b6579",
            SERVER_IP: "182.140.186.147"
        }, P = {
            SOUND: 2106,
            FILE: 2107
        }, a = {
            IMAGE: 1,
            FILE: 2,
            SHORT_VIDEO: 3,
            SOUND: 4
        }, G = {
            APP_VERSION: "2.1",
            SERVER_VERSION: 1
        }, u = {
            C2C: 1,
            GROUP_COMMON: 3,
            GROUP_TIP: 4,
            GROUP_SYSTEM: 5,
            GROUP_TIP2: 6,
            FRIEND_NOTICE: 7,
            PROFILE_NOTICE: 8,
            C2C_COMMON: 9,
            C2C_EVENT: 10
        }, h = {
            COMMON: 0
        }, F = {
            READED: 92,
            KICKEDOUT: 96
        }, l = {
            COMMON: 0,
            LOVEMSG: 1,
            TIP: 2,
            REDPACKET: 3
        }, R = {
            REDPACKET: 1,
            COMMON: 2,
            LOVEMSG: 3
        }, S = {
            JOIN: 1,
            QUIT: 2,
            KICK: 3,
            SET_ADMIN: 4,
            CANCEL_ADMIN: 5,
            MODIFY_GROUP_INFO: 6,
            MODIFY_MEMBER_INFO: 7
        }, K = {
            FACE_URL: 1,
            NAME: 2,
            OWNER: 3,
            NOTIFICATION: 4,
            INTRODUCTION: 5
        }, U = {
            JOIN_GROUP_REQUEST: 1,
            JOIN_GROUP_ACCEPT: 2,
            JOIN_GROUP_REFUSE: 3,
            KICK: 4,
            DESTORY: 5,
            CREATE: 6,
            INVITED_JOIN_GROUP_REQUEST: 7,
            QUIT: 8,
            SET_ADMIN: 9,
            CANCEL_ADMIN: 10,
            REVOKE: 11,
            READED: 15,
            CUSTOM: 255,
            INVITED_JOIN_GROUP_REQUEST_AGREE: 12
        }, O = {
            FRIEND_ADD: 1,
            FRIEND_DELETE: 2,
            PENDENCY_ADD: 3,
            PENDENCY_DELETE: 4,
            BLACK_LIST_ADD: 5,
            BLACK_LIST_DELETE: 6,
            PENDENCY_REPORT: 7,
            FRIEND_UPDATE: 8
        }, p = {
            PROFILE_MODIFY: 1
        }, J = {
            OK: 0,
            SIGNATURE_EXPIRATION: 11
        }, Y = {
            INIT: -1,
            ON: 0,
            RECONNECT: 1,
            OFF: 9999
        }, m = {
            GROUP_MSG: 1,
            C2C_MSG: 2,
            USER_HEAD: 3,
            GROUP_HEAD: 4
        }, k = {
            ING: 14,
            STOP: 15
        }, N = Y.INIT, d = !1, H = 0, L = 6e4, y = null, T = 0, v = 0, x = 0, j = null, z = null, W = 0, b = [], q = null, V = null, Z = {
            sdkAppID: null,
            appIDAt3rd: null,
            accountType: null,
            identifier: null,
            tinyid: null,
            identifierNick: null,
            userSig: null,
            a2: null,
            contentType: "json",
            apn: 1
        }, X = {}, _ = 0, $ = {}, AA = 0, eA = [], oA = [], iA = [], CA = {
            downloadMap: {}
        }, gA = {
            "[惊讶]": 0,
            "[撇嘴]": 1,
            "[色]": 2,
            "[发呆]": 3,
            "[得意]": 4,
            "[流泪]": 5,
            "[害羞]": 6,
            "[闭嘴]": 7,
            "[睡]": 8,
            "[大哭]": 9,
            "[尴尬]": 10,
            "[发怒]": 11,
            "[调皮]": 12,
            "[龇牙]": 13,
            "[微笑]": 14,
            "[难过]": 15,
            "[酷]": 16,
            "[冷汗]": 17,
            "[抓狂]": 18,
            "[吐]": 19,
            "[偷笑]": 20,
            "[可爱]": 21,
            "[白眼]": 22,
            "[傲慢]": 23,
            "[饿]": 24,
            "[困]": 25,
            "[惊恐]": 26,
            "[流汗]": 27,
            "[憨笑]": 28,
            "[大兵]": 29,
            "[奋斗]": 30,
            "[咒骂]": 31,
            "[疑问]": 32,
            "[嘘]": 33,
            "[晕]": 34
        }, EA = {
            0: [ "[惊讶]", "" ],
            1: [ "[撇嘴]", "" ],
            2: [ "[色]", "" ],
            3: [ "[发呆]", "" ],
            4: [ "[得意]", "" ],
            5: [ "[流泪]", "" ],
            6: [ "[害羞]", "" ],
            7: [ "[闭嘴]", "" ],
            8: [ "[睡]", "" ],
            9: [ "[大哭]", "" ],
            10: [ "[尴尬]", "" ],
            11: [ "[发怒]", "" ],
            12: [ "[调皮]", "" ],
            13: [ "[龇牙]", "" ],
            14: [ "[微笑]", "" ],
            15: [ "[难过]", "" ],
            16: [ "[酷]", "" ],
            17: [ "[冷汗]", "" ],
            18: [ "[抓狂]", "" ],
            19: [ "[吐]", "" ],
            20: [ "[偷笑]", "" ],
            21: [ "[可爱]", "" ],
            22: [ "[白眼]", "" ],
            23: [ "[傲慢]", "" ],
            24: [ "[饿]", "" ],
            25: [ "[困]", "" ],
            26: [ "[惊恐]", "" ],
            27: [ "[流汗]", "" ],
            28: [ "[憨笑]", "" ],
            29: [ "[大兵]", "" ],
            30: [ "[奋斗]", "" ],
            31: [ "[咒骂]", "" ],
            32: [ "[疑问]", "" ],
            33: [ "[嘘]", "" ],
            34: [ "[晕]", "" ]
        }, IA = new function() {
            this.formatTimeStamp = function(A, e) {
                if (!A) return 0;
                var o;
                e = e || "yyyy-MM-dd hh:mm:ss";
                var i = new Date(1e3 * A), C = {
                    "M+": i.getMonth() + 1,
                    "d+": i.getDate(),
                    "h+": i.getHours(),
                    "m+": i.getMinutes(),
                    "s+": i.getSeconds()
                };
                o = /(y+)/.test(e) ? e.replace(RegExp.$1, (i.getFullYear() + "").substr(4 - RegExp.$1.length)) : e;
                for (var g in C) new RegExp("(" + g + ")").test(o) && (o = o.replace(RegExp.$1, 1 == RegExp.$1.length ? C[g] : ("00" + C[g]).substr(("" + C[g]).length)));
                return o;
            }, this.groupTypeEn2Ch = function(A) {
                var e = null;
                switch (A) {
                  case "Public":
                    e = "公开群";
                    break;

                  case "ChatRoom":
                    e = "聊天室";
                    break;

                  case "Private":
                    e = "私有群";
                    break;

                  case "AVChatRoom":
                    e = "直播聊天室";
                    break;

                  default:
                    e = A;
                }
                return e;
            }, this.groupTypeCh2En = function(A) {
                var e = null;
                switch (A) {
                  case "公开群":
                    e = "Public";
                    break;

                  case "聊天室":
                    e = "ChatRoom";
                    break;

                  case "私有群":
                    e = "Private";
                    break;

                  case "直播聊天室":
                    e = "AVChatRoom";
                    break;

                  default:
                    e = A;
                }
                return e;
            }, this.groupRoleEn2Ch = function(A) {
                var e = null;
                switch (A) {
                  case "Member":
                    e = "成员";
                    break;

                  case "Admin":
                    e = "管理员";
                    break;

                  case "Owner":
                    e = "群主";
                    break;

                  default:
                    e = A;
                }
                return e;
            }, this.groupRoleCh2En = function(A) {
                var e = null;
                switch (A) {
                  case "成员":
                    e = "Member";
                    break;

                  case "管理员":
                    e = "Admin";
                    break;

                  case "群主":
                    e = "Owner";
                    break;

                  default:
                    e = A;
                }
                return e;
            }, this.groupMsgFlagEn2Ch = function(A) {
                var e = null;
                switch (A) {
                  case "AcceptAndNotify":
                    e = "接收并提示";
                    break;

                  case "AcceptNotNotify":
                    e = "接收不提示";
                    break;

                  case "Discard":
                    e = "屏蔽";
                    break;

                  default:
                    e = A;
                }
                return e;
            }, this.groupMsgFlagCh2En = function(A) {
                var e = null;
                switch (A) {
                  case "接收并提示":
                    e = "AcceptAndNotify";
                    break;

                  case "接收不提示":
                    e = "AcceptNotNotify";
                    break;

                  case "屏蔽":
                    e = "Discard";
                    break;

                  default:
                    e = A;
                }
                return e;
            }, this.formatText2Html = function(A) {
                var e = A;
                return e && (e = (e = (e = this.xssFilter(e)).replace(/ /g, "&nbsp;")).replace(/\n/g, "<br/>")), 
                e;
            }, this.formatHtml2Text = function(A) {
                var e = A;
                return e && (e = (e = e.replace(/&nbsp;/g, " ")).replace(/<br\/>/g, "\n")), e;
            }, this.getStrBytes = function(A) {
                if (null == A || void 0 === A) return 0;
                if ("string" != typeof A) return 0;
                var e, o, i, C = 0;
                for (o = 0, i = A.length; o < i; o++) C += (e = A.charCodeAt(o)) <= 127 ? 1 : e <= 2047 ? 2 : e <= 65535 ? 3 : 4;
                return C;
            }, this.xssFilter = function(A) {
                return A = A.toString(), A = A.replace(/[<]/g, "&lt;"), A = A.replace(/[>]/g, "&gt;"), 
                A = A.replace(/"/g, "&quot;");
            }, this.trimStr = function(A) {
                return A ? (A = A.toString()).replace(/(^\s*)|(\s*$)/g, "") : "";
            }, this.validNumber = function(A) {
                return (A = A.toString()).match(/(^\d{1,8}$)/g);
            }, this.getReturnError = function(A, e) {
                return e || (e = -100), {
                    ActionStatus: M.FAIL,
                    ErrorCode: e,
                    ErrorInfo: A + "[" + e + "]"
                };
            }, this.setCookie = function(A, e, o, i, C) {}, this.getCookie = function(A) {
                return null;
            }, this.delCookie = function(A) {
                var e = new Date();
                e.setTime(e.getTime() - 1);
                var o = this.getCookie(A);
                null != o && (document.cookie = A + "=" + escape(o) + ";expires=" + e.toGMTString());
            }, this.getQueryString = function(A) {
                var e = new RegExp("(^|&)" + A + "=([^&]*)(&|$)", "i"), o = location.search.substr(1).match(e);
                return null != o ? unescape(o[2]) : null;
            };
        }(), nA = new function() {
            var A = !0;
            this.setOn = function(e) {
                A = e;
            }, this.getOn = function() {
                return A;
            }, this.error = function(e) {
                try {
                    A && console.error(e);
                } catch (A) {}
            }, this.warn = function(e) {
                try {
                    A && console.warn(e);
                } catch (A) {}
            }, this.info = function(e) {
                try {
                    A && console.info(e);
                } catch (A) {}
            }, this.debug = function(e) {
                try {
                    A && console.debug(e);
                } catch (A) {}
            };
        }(), tA = function(A) {
            return A || (A = new Date()), Math.round(A.getTime() / 1e3);
        }, QA = function() {
            return AA ? AA += 1 : AA = Math.round(1e7 * Math.random()), AA;
        }, BA = function() {
            return Math.round(4294967296 * Math.random());
        }, sA = function(A, e, o, i, C, g, E) {
            wx.request({
                url: e,
                data: o,
                dataType: "json",
                method: A,
                header: {
                    "Content-Type": "application/json"
                },
                success: function(A) {
                    H = T = 0, g && g(A.data);
                },
                fail: function(A) {
                    setTimeout(function() {
                        var A = IA.getReturnError("请求服务器失败,请检查你的网络是否正常", -2);
                        E && E(A);
                    }, 16);
                }
            });
        }, MA = function(A, e, o, i, C, g, E) {
            sA(A, e, JSON.stringify(o), 0, 0, function(A) {
                var e = null;
                A && (e = A), g && g(e);
            }, E);
        }, wA = function() {
            return Z.sdkAppID && Z.identifier;
        }, rA = function(A, e) {
            if (!wA()) {
                if (e) {
                    var o = IA.getReturnError("请登录", -4);
                    A && A(o);
                }
                return !1;
            }
            return !0;
        }, DA = function() {
            return C;
        }, fA = function(A, e, o, C) {
            var E = g;
            E = DA() ? g.FORMAL.COMMON : g.TEST.COMMON, A == I.PIC && (E = DA() ? g.FORMAL.PIC : g.TEST.PIC);
            var t = E + "/" + n[A] + "/" + A + "/" + e + "?websdkappid=" + i.APPID + "&v=" + i.VERSION;
            if (wA()) {
                if ("login" == e) t += "&identifier=" + encodeURIComponent(Z.identifier) + "&usersig=" + Z.userSig; else if (Z.tinyid && Z.a2) t += "&tinyid=" + Z.tinyid + "&a2=" + Z.a2; else if (C) return nA.error("tinyid或a2为空[" + A + "][" + e + "]"), 
                C(IA.getReturnError("tinyid或a2为空[" + A + "][" + e + "]", -5)), !1;
                t += "&contenttype=" + Z.contentType;
            }
            return t += "&sdkappid=" + Z.sdkAppID + "&accounttype=" + Z.accountType + "&apn=" + Z.apn + "&reqtime=" + tA();
        }, cA = function(A, e) {
            var o = null;
            return q && b[0] ? o = "http://" + b[0] + "/asn.com/stddownload_common_file?authkey=" + q + "&bid=" + c.BUSSINESS_ID + "&subbid=" + Z.sdkAppID + "&fileid=" + A + "&filetype=" + P.SOUND + "&openid=" + e + "&ver=0" : nA.error("拼接语音下载url不报错：ip或者authkey为空"), 
            o;
        }, PA = function(A, e, o) {
            var i = null;
            return q && b[0] ? i = "http://" + b[0] + "/asn.com/stddownload_common_file?authkey=" + q + "&bid=" + c.BUSSINESS_ID + "&subbid=" + Z.sdkAppID + "&fileid=" + A + "&filetype=" + P.FILE + "&openid=" + e + "&ver=0&filename=" + encodeURIComponent(o) : nA.error("拼接文件下载url不报错：ip或者authkey为空"), 
            CA.downloadMap["uuid_" + A] = i, i;
        }, aA = function(A, e, o, i, C, g, E) {
            var I = {
                From_Account: e,
                To_Account: C,
                os_platform: 10,
                Timestamp: tA().toString(),
                Random: BA().toString(),
                request_info: [ {
                    busi_id: g,
                    download_flag: i,
                    type: E,
                    uuid: A,
                    version: G.SERVER_VERSION,
                    auth_key: q,
                    ip: b[0]
                } ]
            };
            le(I, function(A) {
                0 == A.error_code && A.response_info && (CA.downloadMap["uuid_" + I.uuid] = A.response_info.url), 
                onAppliedDownloadUrl && onAppliedDownloadUrl({
                    uuid: I.uuid,
                    url: A.response_info.url,
                    maps: CA.downloadMap
                });
            }, function(A) {
                nA.error("获取下载地址失败", I.uuid);
            });
        }, GA = function() {
            for (var A in $) {
                var e = $[A];
                e && (e.abort(), $[_] = null);
            }
            _ = 0, $ = {};
        }, uA = function() {
            GA(), Z = {
                sdkAppID: null,
                appIDAt3rd: null,
                accountType: null,
                identifier: null,
                identifierNick: null,
                userSig: null,
                contentType: "json",
                apn: 1
            }, X = {}, AA = 0, x = 0, j = null, iA = [], pe.clear(), y = null;
        }, hA = function(A, e, o, i, g) {
            uA(), o && (X = o), 0 == X.isAccessFormalEnv && (C = X.isAccessFormalEnv), 0 == X.isLogOn && nA.setOn(X.isLogOn), 
            A || !g ? A.sdkAppID || !g ? A.accountType || !g ? (A.identifier && (Z.identifier = A.identifier.toString()), 
            A.identifier && !A.userSig && g ? g(IA.getReturnError("loginInfo.userSig is empty", -9)) : (A.userSig && (Z.userSig = A.userSig.toString()), 
            Z.sdkAppID = A.sdkAppID, Z.accountType = A.accountType, Z.identifier && Z.userSig ? lA(function(A, o) {
                pe.init(e, function(e) {
                    i && (e.identifierNick = A, e.headurl = o, i(e));
                }, g);
            }, g) : pe.init(e, i, g))) : g(IA.getReturnError("loginInfo.accountType is empty", -8)) : g(IA.getReturnError("loginInfo.sdkAppID is empty", -7)) : g(IA.getReturnError("loginInfo is empty", -6));
        }, FA = function(A, e, o) {
            if ("longpolling" != A || 60008 != e && 91101 != e) {
                var C = t[A];
                if (C) {
                    var g = tA(), E = null, I = {
                        Code: e,
                        ErrMsg: o
                    };
                    if (Z.a2 ? E = Z.a2.substring(0, 10) + "_" + g + "_" + BA() : Z.userSig && (E = Z.userSig.substring(0, 10) + "_" + g + "_" + BA()), 
                    E) {
                        var n = {
                            UniqKey: E,
                            EventId: C,
                            ReportTime: g,
                            MsgCmdErrorCode: I
                        };
                        if ("login" == A) {
                            var Q = [];
                            Q.push(n), he({
                                EvtItems: Q,
                                MainVersion: i.VERSION,
                                Version: "0"
                            }, function(A) {
                                Q = null;
                            }, function(A) {
                                Q = null;
                            });
                        } else iA.push(n), iA.length >= 20 && he({
                            EvtItems: iA,
                            MainVersion: i.VERSION,
                            Version: "0"
                        }, function(A) {
                            iA = [];
                        }, function(A) {
                            iA = [];
                        });
                    }
                }
            }
        }, lA = function(A, e) {
            Re.apiCall(I.OPEN_IM, "login", {
                State: "Online"
            }, function(o) {
                if (o.TinyId) Z.tinyid = o.TinyId; else if (e) return void e(IA.getReturnError("TinyId is empty", -10));
                if (o.A2Key) Z.a2 = o.A2Key; else if (e) return void e(IA.getReturnError("A2Key is empty", -11));
                var i = [ "Tag_Profile_IM_Nick", "Tag_Profile_IM_Image" ], C = {
                    From_Account: Z.identifier,
                    To_Account: [ Z.identifier ],
                    LastStandardSequence: 0,
                    TagList: i
                };
                re(C, function(e) {
                    var o;
                    if (e.UserProfileItem && e.UserProfileItem.length > 0) for (var i in e.UserProfileItem) for (var C in e.UserProfileItem[i].ProfileItem) switch (e.UserProfileItem[i].ProfileItem[C].Tag) {
                      case "Tag_Profile_IM_Nick":
                        (o = e.UserProfileItem[i].ProfileItem[C].Value) && (Z.identifierNick = o);
                        break;

                      case "Tag_Profile_IM_Image":
                        var g = e.UserProfileItem[i].ProfileItem[C].Value;
                        g && (Z.headurl = g);
                    }
                    A && A(Z.identifierNick, Z.headurl);
                }, e);
            }, e);
        }, RA = function(A, e, o) {
            if (!rA(o, !1)) return uA(), void (e && e({
                ActionStatus: M.OK,
                ErrorCode: 0,
                ErrorInfo: "logout success"
            }));
            "all" == A ? Re.apiCall(I.OPEN_IM, "logout", {}, function(A) {
                uA(), e && e(A);
            }, o) : Re.apiCall(I.OPEN_IM, "longpollinglogout", {
                LongPollingId: y
            }, function(A) {
                uA(), e && e(A);
            }, o);
        }, SA = function(A, e, o) {
            if (rA(o, !0)) {
                var i = null;
                switch (A.sess.type()) {
                  case Q.C2C:
                    i = {
                        From_Account: Z.identifier,
                        To_Account: A.sess.id().toString(),
                        MsgTimeStamp: A.time,
                        MsgSeq: A.seq,
                        MsgRandom: A.random,
                        MsgBody: []
                    };
                    break;

                  case Q.GROUP:
                    var C = A.getSubType();
                    switch (i = {
                        GroupId: A.sess.id().toString(),
                        From_Account: Z.identifier,
                        Random: A.random,
                        MsgBody: []
                    }, C) {
                      case l.COMMON:
                        i.MsgPriority = "COMMON";
                        break;

                      case l.REDPACKET:
                        i.MsgPriority = "REDPACKET";
                        break;

                      case l.LOVEMSG:
                        i.MsgPriority = "LOVEMSG";
                        break;

                      case l.TIP:
                        nA.error("不能主动发送群提示消息,subType=" + C);
                        break;

                      default:
                        return void nA.error("发送群消息时，出现未知子消息类型：subType=" + C);
                    }
                }
                for (var g in A.elems) {
                    var E = A.elems[g], n = null, t = E.type;
                    switch (t) {
                      case w.TEXT:
                        n = {
                            Text: E.content.text
                        };
                        break;

                      case w.FACE:
                        n = {
                            Index: E.content.index,
                            Data: E.content.data
                        };
                        break;

                      case w.IMAGE:
                        var B = [];
                        for (var s in E.content.ImageInfoArray) B.push({
                            Type: E.content.ImageInfoArray[s].type,
                            Size: E.content.ImageInfoArray[s].size,
                            Width: E.content.ImageInfoArray[s].width,
                            Height: E.content.ImageInfoArray[s].height,
                            URL: E.content.ImageInfoArray[s].url
                        });
                        n = {
                            ImageFormat: E.content.ImageFormat,
                            UUID: E.content.UUID,
                            ImageInfoArray: B
                        };
                        break;

                      case w.SOUND:
                        nA.warn("web端暂不支持发送语音消息");
                        continue;

                      case w.LOCATION:
                        nA.warn("web端暂不支持发送地理位置消息");
                        continue;

                      case w.FILE:
                        n = {
                            UUID: E.content.uuid,
                            FileName: E.content.name,
                            FileSize: E.content.size,
                            DownloadFlag: E.content.downFlag
                        };
                        break;

                      case w.CUSTOM:
                        n = {
                            Data: E.content.data,
                            Desc: E.content.desc,
                            Ext: E.content.ext
                        }, t = w.CUSTOM;
                        break;

                      default:
                        nA.warn("web端暂不支持发送" + E.type + "消息");
                        continue;
                    }
                    A.PushInfoBoolean && (i.OfflinePushInfo = A.PushInfo), i.MsgBody.push({
                        MsgType: t,
                        MsgContent: n
                    });
                }
                A.sess.type() == Q.C2C ? Re.apiCall(I.OPEN_IM, "sendmsg", i, e, o) : A.sess.type() == Q.GROUP && Re.apiCall(I.GROUP, "send_group_msg", i, e, o);
            }
        }, KA = function(A, e, o) {
            (C || "undefined" == typeof stopPolling || 1 != stopPolling) && rA(o, !0) && Re.apiCall(I.OPEN_IM, "longpolling", A, e, o, L, !0);
        }, UA = function(A, e, o, i) {
            Re.apiCall(I.BIG_GROUP_LONG_POLLING, "get_msg", A, e, o, i);
        }, OA = function A(e, o, i, C) {
            rA(C, !0) && Re.apiCall(I.OPEN_IM, "getmsg", {
                Cookie: e,
                SyncFlag: o
            }, function(e) {
                if (e.MsgList && e.MsgList.length) for (var o in e.MsgList) eA.push(e.MsgList[o]);
                1 == e.SyncFlag ? A(e.Cookie, e.SyncFlag, i, C) : (e.MsgList = eA, eA = [], i && i(e));
            }, C);
        }, pA = function(A, e, o, i) {
            if (rA(i, !0)) {
                var C = [];
                for (var g in e) {
                    var E = {
                        To_Account: e[g].toAccount,
                        LastedMsgTime: e[g].lastedMsgTime
                    };
                    C.push(E);
                }
                Re.apiCall(I.OPEN_IM, "msgreaded", {
                    C2CMsgReaded: {
                        Cookie: A,
                        C2CMsgReadedItem: C
                    }
                }, o, i);
            }
        }, JA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.OPEN_IM, "deletemsg", A, e, o);
        }, YA = function A(e, o, i) {
            rA(i, !0) && Re.apiCall(I.OPEN_IM, "getroammsg", e, function(C) {
                var g = e.MaxCnt, E = C.Complete, I = C.MaxCnt, n = C.MsgKey, t = C.LastMsgTime;
                if (C.MsgList && C.MsgList.length) for (var Q in C.MsgList) oA.push(C.MsgList[Q]);
                var B = null;
                0 == E && I < g && (B = {
                    Peer_Account: e.Peer_Account,
                    MaxCnt: g - I,
                    LastMsgTime: t,
                    MsgKey: n
                }), B ? A(B, o, i) : (C.MsgList = oA, oA = [], o && o(C));
            }, i);
        }, mA = function(A, e, o) {
            if (rA(o, !0)) {
                for (var i = {
                    Type: A.Type,
                    Name: A.Name
                }, C = [], g = 0; g < A.MemberList.length; g++) C.push({
                    Member_Account: A.MemberList[g]
                });
                i.MemberList = C, A.GroupId && (i.GroupId = A.GroupId), A.Owner_Account && (i.Owner_Account = A.Owner_Account), 
                A.Introduction && (i.Introduction = A.Introduction), A.Notification && (i.Notification = A.Notification), 
                A.MaxMemberCount && (i.MaxMemberCount = A.MaxMemberCount), A.ApplyJoinOption && (i.ApplyJoinOption = A.ApplyJoinOption), 
                A.AppDefinedData && (i.AppDefinedData = A.AppDefinedData), A.FaceUrl && (i.FaceUrl = A.FaceUrl), 
                Re.apiCall(I.GROUP, "create_group", i, e, o);
            }
        }, kA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "create_group", A, e, o);
        }, NA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "modify_group_base_info", A, e, o);
        }, dA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "apply_join_group", {
                GroupId: A.GroupId,
                ApplyMsg: A.ApplyMsg,
                UserDefinedField: A.UserDefinedField
            }, e, o);
        }, HA = function(A, e, o) {
            var i;
            i = rA(o, !1) ? I.GROUP : I.BIG_GROUP, Re.apiCall(i, "apply_join_group", {
                GroupId: A.GroupId,
                ApplyMsg: A.ApplyMsg,
                UserDefinedField: A.UserDefinedField
            }, function(i) {
                if (i.JoinedStatus && "JoinedSuccess" == i.JoinedStatus) {
                    if (!i.LongPollingKey) return void (o && o(IA.getReturnError("Join Group succeed; But the type of group is not AVChatRoom: groupid=" + A.GroupId, -12)));
                    pe.setBigGroupLongPollingOn(!0), pe.setBigGroupLongPollingKey(i.LongPollingKey), 
                    pe.setBigGroupLongPollingMsgMap(A.GroupId, 0), pe.bigGroupLongPolling();
                }
                e && e(i);
            }, function(A) {
                o && o(A);
            });
        }, LA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "handle_apply_join_group", {
                GroupId: A.GroupId,
                Applicant_Account: A.Applicant_Account,
                HandleMsg: A.HandleMsg,
                Authentication: A.Authentication,
                MsgKey: A.MsgKey,
                ApprovalMsg: A.ApprovalMsg,
                UserDefinedField: A.UserDefinedField
            }, e, function(A) {
                if (10024 == A.ErrorCode) {
                    if (e) {
                        var i = {
                            ActionStatus: M.OK,
                            ErrorCode: 0,
                            ErrorInfo: "该申请已经被处理过"
                        };
                        e(i);
                    }
                } else o && o(A);
            });
        }, yA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "get_pendency", {
                StartTime: A.StartTime,
                Limit: A.Limit,
                Handle_Account: Z.identifier
            }, e, function(A) {});
        }, TA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "report_pendency", {
                ReportTime: A.ReportTime,
                From_Account: Z.identifier
            }, e, function(A) {});
        }, vA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "handle_invite_join_group", {
                GroupId: A.GroupId,
                Inviter_Account: A.Inviter_Account,
                HandleMsg: A.HandleMsg,
                Authentication: A.Authentication,
                MsgKey: A.MsgKey,
                ApprovalMsg: A.ApprovalMsg,
                UserDefinedField: A.UserDefinedField
            }, e, function(A) {});
        }, xA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "quit_group", {
                GroupId: A.GroupId
            }, e, o);
        }, jA = function(A, e, o) {
            var i;
            i = rA(o, !1) ? I.GROUP : I.BIG_GROUP, Re.apiCall(i, "quit_group", {
                GroupId: A.GroupId
            }, function(A) {
                pe.resetBigGroupLongPollingInfo(), e && e(A);
            }, o);
        }, zA = function(A, e, o) {
            Re.apiCall(I.GROUP, "search_group", A, e, o);
        }, WA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "get_group_public_info", {
                GroupIdList: A.GroupIdList,
                ResponseFilter: {
                    GroupBasePublicInfoFilter: A.GroupBasePublicInfoFilter
                }
            }, function(A) {
                if (A.ErrorInfo = "", A.GroupInfo) for (var i in A.GroupInfo) {
                    var C = A.GroupInfo[i].ErrorCode;
                    C > 0 && (A.ActionStatus = M.FAIL, A.GroupInfo[i].ErrorInfo = "[" + C + "]" + A.GroupInfo[i].ErrorInfo, 
                    A.ErrorInfo += A.GroupInfo[i].ErrorInfo + "\n");
                }
                A.ActionStatus == M.FAIL ? o && o(A) : e && e(A);
            }, o);
        }, bA = function(A, e, o) {
            if (rA(o, !0)) {
                var i = {
                    GroupIdList: A.GroupIdList,
                    ResponseFilter: {
                        GroupBaseInfoFilter: A.GroupBaseInfoFilter,
                        MemberInfoFilter: A.MemberInfoFilter
                    }
                };
                A.AppDefinedDataFilter_Group && (i.ResponseFilter.AppDefinedDataFilter_Group = A.AppDefinedDataFilter_Group), 
                A.AppDefinedDataFilter_GroupMember && (i.ResponseFilter.AppDefinedDataFilter_GroupMember = A.AppDefinedDataFilter_GroupMember), 
                Re.apiCall(I.GROUP, "get_group_info", i, e, o);
            }
        }, qA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "get_group_member_info", {
                GroupId: A.GroupId,
                Offset: A.Offset,
                Limit: A.Limit,
                MemberInfoFilter: A.MemberInfoFilter,
                MemberRoleFilter: A.MemberRoleFilter,
                AppDefinedDataFilter_GroupMember: A.AppDefinedDataFilter_GroupMember
            }, e, o);
        }, VA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "add_group_member", {
                GroupId: A.GroupId,
                Silence: A.Silence,
                MemberList: A.MemberList
            }, e, o);
        }, ZA = function(A, e, o) {
            if (rA(o, !0)) {
                var i = {};
                A.GroupId && (i.GroupId = A.GroupId), A.Member_Account && (i.Member_Account = A.Member_Account), 
                A.Role && (i.Role = A.Role), A.MsgFlag && (i.MsgFlag = A.MsgFlag), A.ShutUpTime && (i.ShutUpTime = A.ShutUpTime), 
                A.NameCard && (i.NameCard = A.NameCard), A.AppMemberDefinedData && (i.AppMemberDefinedData = A.AppMemberDefinedData), 
                Re.apiCall(I.GROUP, "modify_group_member_info", i, e, o);
            }
        }, XA = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "delete_group_member", {
                GroupId: A.GroupId,
                Silence: A.Silence,
                MemberToDel_Account: A.MemberToDel_Account,
                Reason: A.Reason
            }, e, o);
        }, _A = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "destroy_group", {
                GroupId: A.GroupId
            }, e, o);
        }, $A = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "change_group_owner", A, e, o);
        }, Ae = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "get_joined_group_list", {
                Member_Account: A.Member_Account,
                Limit: A.Limit,
                Offset: A.Offset,
                GroupType: A.GroupType,
                ResponseFilter: {
                    GroupBaseInfoFilter: A.GroupBaseInfoFilter,
                    SelfInfoFilter: A.SelfInfoFilter
                }
            }, e, o);
        }, ee = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "get_role_in_group", {
                GroupId: A.GroupId,
                User_Account: A.User_Account
            }, e, o);
        }, oe = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "forbid_send_msg", {
                GroupId: A.GroupId,
                Members_Account: A.Members_Account,
                ShutUpTime: A.ShutUpTime
            }, e, o);
        }, ie = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "send_group_system_notification", A, e, o);
        }, Ce = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "group_msg_get", {
                GroupId: A.GroupId,
                ReqMsgSeq: A.ReqMsgSeq,
                ReqMsgNumber: A.ReqMsgNumber
            }, e, o);
        }, ge = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.GROUP, "msg_read_report", {
                GroupId: A.GroupId,
                MsgReadedSeq: A.MsgReadedSeq
            }, e, o);
        }, Ee = function(A) {
            var e = [];
            if (A.Fail_Account && A.Fail_Account.length && (e = A.Fail_Account), A.Invalid_Account && A.Invalid_Account.length) for (var o in A.Invalid_Account) e.push(A.Invalid_Account[o]);
            if (e.length) {
                A.ActionStatus = M.FAIL, A.ErrorCode = 99999, A.ErrorInfo = "";
                for (var i in e) {
                    var C = e[i];
                    for (var g in A.ResultItem) if (A.ResultItem[g].To_Account == C) {
                        var E = A.ResultItem[g].ResultCode;
                        A.ResultItem[g].ResultInfo = "[" + E + "]" + A.ResultItem[g].ResultInfo, A.ErrorInfo += A.ResultItem[g].ResultInfo + "\n";
                        break;
                    }
                }
            }
            return A;
        }, Ie = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "friend_add", {
                From_Account: Z.identifier,
                AddFriendItem: A.AddFriendItem
            }, function(A) {
                var i = Ee(A);
                i.ActionStatus == M.FAIL ? o && o(i) : e && e(i);
            }, o);
        }, ne = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "friend_delete", {
                From_Account: Z.identifier,
                To_Account: A.To_Account,
                DeleteType: A.DeleteType
            }, function(A) {
                var i = Ee(A);
                i.ActionStatus == M.FAIL ? o && o(i) : e && e(i);
            }, o);
        }, te = function(A, e, o) {
            rA(o, !0) && (1 == A.chatType ? Re.apiCall(I.DEL_CHAT, "delete", {
                From_Account: Z.identifier,
                Type: A.chatType,
                To_Account: A.To_Account
            }, e, o) : Re.apiCall(I.DEL_CHAT, "delete", {
                From_Account: Z.identifier,
                Type: A.chatType,
                ToGroupid: A.To_Account
            }, e, o));
        }, Qe = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "pendency_get", {
                From_Account: Z.identifier,
                PendencyType: A.PendencyType,
                StartTime: A.StartTime,
                MaxLimited: A.MaxLimited,
                LastSequence: A.LastSequence
            }, e, o);
        }, Be = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "PendencyReport", {
                From_Account: Z.identifier,
                LatestPendencyTimeStamp: A.LatestPendencyTimeStamp
            }, e, o);
        }, se = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "pendency_delete", {
                From_Account: Z.identifier,
                PendencyType: A.PendencyType,
                To_Account: A.To_Account
            }, function(A) {
                var i = Ee(A);
                i.ActionStatus == M.FAIL ? o && o(i) : e && e(i);
            }, o);
        }, Me = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "friend_response", {
                From_Account: Z.identifier,
                ResponseFriendItem: A.ResponseFriendItem
            }, function(A) {
                var i = Ee(A);
                i.ActionStatus == M.FAIL ? o && o(i) : e && e(i);
            }, o);
        }, we = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "friend_get_all", {
                From_Account: Z.identifier,
                TimeStamp: A.TimeStamp,
                StartIndex: A.StartIndex,
                GetCount: A.GetCount,
                LastStandardSequence: A.LastStandardSequence,
                TagList: A.TagList
            }, e, o);
        }, re = function(A, e, o) {
            A.To_Account.length > 100 && (A.To_Account.length = 100, nA.error("获取用户资料人数不能超过100人")), 
            rA(o, !0) && Re.apiCall(I.PROFILE, "portrait_get", {
                From_Account: Z.identifier,
                To_Account: A.To_Account,
                TagList: A.TagList
            }, function(A) {
                var i = [];
                if (A.Fail_Account && A.Fail_Account.length && (i = A.Fail_Account), A.Invalid_Account && A.Invalid_Account.length) for (var C in A.Invalid_Account) i.push(A.Invalid_Account[C]);
                if (i.length) {
                    A.ActionStatus = M.FAIL, A.ErrorCode = 99999, A.ErrorInfo = "";
                    for (var g in i) {
                        var E = i[g];
                        for (var I in A.UserProfileItem) if (A.UserProfileItem[I].To_Account == E) {
                            var n = A.UserProfileItem[I].ResultCode;
                            A.UserProfileItem[I].ResultInfo = "[" + n + "]" + A.UserProfileItem[I].ResultInfo, 
                            A.ErrorInfo += "账号:" + E + "," + A.UserProfileItem[I].ResultInfo + "\n";
                            break;
                        }
                    }
                }
                A.ActionStatus == M.FAIL ? o && o(A) : e && e(A);
            }, o);
        }, De = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.PROFILE, "portrait_set", {
                From_Account: Z.identifier,
                ProfileItem: A.ProfileItem
            }, function(o) {
                for (var i in A.ProfileItem) {
                    var C = A.ProfileItem[i];
                    if ("Tag_Profile_IM_Nick" == C.Tag) {
                        Z.identifierNick = C.Value;
                        break;
                    }
                }
                e && e(o);
            }, o);
        }, fe = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "black_list_add", {
                From_Account: Z.identifier,
                To_Account: A.To_Account
            }, function(A) {
                var i = Ee(A);
                i.ActionStatus == M.FAIL ? o && o(i) : e && e(i);
            }, o);
        }, ce = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "black_list_delete", {
                From_Account: Z.identifier,
                To_Account: A.To_Account
            }, function(A) {
                var i = Ee(A);
                i.ActionStatus == M.FAIL ? o && o(i) : e && e(i);
            }, o);
        }, Pe = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.FRIEND, "black_list_get", {
                From_Account: Z.identifier,
                StartIndex: A.StartIndex,
                MaxLimited: A.MaxLimited,
                LastSequence: A.LastSequence
            }, e, o);
        }, ae = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.RECENT_CONTACT, "get", {
                From_Account: Z.identifier,
                Count: A.Count
            }, e, o);
        }, Ge = function(A, e, o) {
            if (rA(o, !0)) {
                var i;
                i = DA() ? "pic_up" : "pic_up_test", Re.apiCall(I.PIC, i, {
                    App_Version: G.APP_VERSION,
                    From_Account: Z.identifier,
                    To_Account: A.To_Account,
                    Seq: A.Seq,
                    Timestamp: A.Timestamp,
                    Random: A.Random,
                    File_Str_Md5: A.File_Str_Md5,
                    File_Size: A.File_Size,
                    File_Type: A.File_Type,
                    Server_Ver: G.SERVER_VERSION,
                    Auth_Key: q,
                    Busi_Id: A.Busi_Id,
                    PkgFlag: A.PkgFlag,
                    Slice_Offset: A.Slice_Offset,
                    Slice_Size: A.Slice_Size,
                    Slice_Data: A.Slice_Data
                }, e, o);
            }
        }, ue = function(A, e) {
            rA(e, !0) && Re.apiCall(I.OPEN_IM, "authkey", {}, A, e);
        }, he = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.IM_OPEN_STAT, "web_report", A, e, o);
        }, Fe = function(A, e, o) {
            rA(o, !0) && Re.apiCall(I.OPEN_IM, "getlongpollingid", {}, function(A) {
                e && e(A);
            }, o);
        }, le = function(A, e, o) {
            Re.apiCall(I.PIC, "apply_download", A, e, o);
        };
        E = "wechat";
        var Re = new function() {
            var A = null;
            this.init = function(e, o, i) {
                e && (A = e);
            }, this.callBack = function(e) {
                A && A(e);
            }, this.clear = function() {
                A = null;
            }, this.apiCall = function(A, e, o, i, C, g, E) {
                var I = fA(A, e, 0, C);
                0 != I && MA("POST", I, o, 0, 0, function(g) {
                    var E = null, n = "";
                    "pic_up" == e && (o.Slice_Data = "");
                    var t = "\n request url: \n" + I + "\n request body: \n" + JSON.stringify(o) + "\n response: \n" + JSON.stringify(g);
                    g.ActionStatus == M.OK ? (nA.info("[" + A + "][" + e + "]success: " + t), i && i(g), 
                    E = 0, n = "") : (E = g.ErrorCode, n = g.ErrorInfo, C && (g.SrcErrorInfo = g.ErrorInfo, 
                    g.ErrorInfo = "[" + A + "][" + e + "]failed: " + t, "longpolling" == e && 60008 == g.ErrorCode || nA.error(g.ErrorInfo), 
                    C(g))), FA(e, E, n);
                }, function(A) {
                    C && C(A), FA(e, A.ErrorCode, A.ErrorInfo);
                });
            };
        }(), Se = function A(e, o, i, C, g, E) {
            this._impl = {
                skey: A.skey(e, o),
                type: e,
                id: o,
                name: i,
                icon: C,
                unread: 0,
                isAutoRead: !1,
                time: g >= 0 ? g : 0,
                curMaxMsgSeq: E >= 0 ? E : 0,
                msgs: [],
                isFinished: 1
            };
        };
        Se.skey = function(A, e) {
            return A + e;
        }, Se.prototype.type = function() {
            return this._impl.type;
        }, Se.prototype.id = function() {
            return this._impl.id;
        }, Se.prototype.name = function() {
            return this._impl.name;
        }, Se.prototype.icon = function() {
            return this._impl.icon;
        }, Se.prototype.unread = function(A) {
            if (void 0 === A) return this._impl.unread;
            this._impl.unread = A;
        }, Se.prototype.isFinished = function(A) {
            if (void 0 === A) return this._impl.isFinished;
            this._impl.isFinished = A;
        }, Se.prototype.time = function() {
            return this._impl.time;
        }, Se.prototype.curMaxMsgSeq = function(A) {
            if (void 0 === A) return this._impl.curMaxMsgSeq;
            this._impl.curMaxMsgSeq = A;
        }, Se.prototype.msgCount = function() {
            return this._impl.msgs.length;
        }, Se.prototype.msg = function(A) {
            return this._impl.msgs[A];
        }, Se.prototype.msgs = function() {
            return this._impl.msgs;
        }, Se.prototype._impl_addMsg = function(A) {
            this._impl.msgs.push(A), A.time > this._impl.time && (this._impl.time = A.time), 
            A.seq > this._impl.curMaxMsgSeq && (this._impl.curMaxMsgSeq = A.seq), A.isSend || this._impl.isAutoRead || this._impl.unread++;
        };
        var Ke = function(A, e) {
            this.toAccount = A, this.lastedMsgTime = e;
        }, Ue = function(A, e, o, i, C, g, E, I) {
            this.sess = A, this.subType = E >= 0 ? E : 0, this.fromAccount = g, this.fromAccountNick = I || g, 
            this.isSend = Boolean(e), this.seq = o >= 0 ? o : QA(), this.random = i >= 0 ? i : BA(), 
            this.time = C >= 0 ? C : tA(), this.elems = [];
        };
        Ue.prototype.getSession = function() {
            return this.sess;
        }, Ue.prototype.getType = function() {
            return this.subType;
        }, Ue.prototype.getSubType = function() {
            return this.subType;
        }, Ue.prototype.getFromAccount = function() {
            return this.fromAccount;
        }, Ue.prototype.getFromAccountNick = function() {
            return this.fromAccountNick;
        }, Ue.prototype.getIsSend = function() {
            return this.isSend;
        }, Ue.prototype.getSeq = function() {
            return this.seq;
        }, Ue.prototype.getTime = function() {
            return this.time;
        }, Ue.prototype.getRandom = function() {
            return this.random;
        }, Ue.prototype.getElems = function() {
            return this.elems;
        }, Ue.prototype.addText = function(A) {
            this.addElem(new o.Msg.Elem(w.TEXT, A));
        }, Ue.prototype.addFace = function(A) {
            this.addElem(new o.Msg.Elem(w.FACE, A));
        }, Ue.prototype.addImage = function(A) {
            this.addElem(new o.Msg.Elem(w.IMAGE, A));
        }, Ue.prototype.addLocation = function(A) {
            this.addElem(new o.Msg.Elem(w.LOCATION, A));
        }, Ue.prototype.addFile = function(A) {
            this.addElem(new o.Msg.Elem(w.FILE, A));
        }, Ue.prototype.addCustom = function(A) {
            this.addElem(new o.Msg.Elem(w.CUSTOM, A));
        }, Ue.prototype.addElem = function(A) {
            this.elems.push(A);
        }, Ue.prototype.toHtml = function() {
            var A = "";
            for (var e in this.elems) A += this.elems[e].toHtml();
            return A;
        }, (Ue.Elem = function(A, e) {
            this.type = A, this.content = e;
        }).prototype.getType = function() {
            return this.type;
        }, Ue.Elem.prototype.getContent = function() {
            return this.content;
        }, Ue.Elem.prototype.toHtml = function() {
            return this.content.toHtml();
        }, Ue.Elem.Text = function(A) {
            this.text = IA.xssFilter(A);
        }, Ue.Elem.Text.prototype.getText = function() {
            return this.text;
        }, Ue.Elem.Text.prototype.toHtml = function() {
            return this.text;
        }, Ue.Elem.Face = function(A, e) {
            this.index = A, this.data = e;
        }, Ue.Elem.Face.prototype.getIndex = function() {
            return this.index;
        }, Ue.Elem.Face.prototype.getData = function() {
            return this.data;
        }, Ue.Elem.Face.prototype.toHtml = function() {
            var A = null, e = gA[this.data], o = EA[e];
            return o && o[1] && (A = o[1]), A ? "<img src='" + A + "'/>" : this.data;
        }, Ue.Elem.Location = function(A, e, o) {
            this.latitude = e, this.longitude = A, this.desc = o;
        }, Ue.Elem.Location.prototype.getLatitude = function() {
            return this.latitude;
        }, Ue.Elem.Location.prototype.getLongitude = function() {
            return this.longitude;
        }, Ue.Elem.Location.prototype.getDesc = function() {
            return this.desc;
        }, Ue.Elem.Location.prototype.toHtml = function() {
            return "经度=" + this.longitude + ",纬度=" + this.latitude + ",描述=" + this.desc;
        }, Ue.Elem.Images = function(A, e) {
            this.UUID = A, "number" != typeof e && (e = parseInt(D[e] || D.UNKNOWN, 10)), this.ImageFormat = e, 
            this.ImageInfoArray = [];
        }, Ue.Elem.Images.prototype.addImage = function(A) {
            this.ImageInfoArray.push(A);
        }, Ue.Elem.Images.prototype.toHtml = function() {
            var A = this.getImage(r.SMALL), e = this.getImage(r.LARGE), o = this.getImage(r.ORIGIN);
            return e || (e = A), o || (o = A), "<img src='" + A.getUrl() + "#" + e.getUrl() + "#" + o.getUrl() + "' style='CURSOR: hand' id='" + this.getImageId() + "' bigImgUrl='" + e.getUrl() + "' onclick='imageClick(this)' />";
        }, Ue.Elem.Images.prototype.getImageId = function() {
            return this.UUID;
        }, Ue.Elem.Images.prototype.getImageFormat = function() {
            return this.ImageFormat;
        }, Ue.Elem.Images.prototype.getImage = function(A) {
            for (var e in this.ImageInfoArray) if (this.ImageInfoArray[e].getType() == A) return this.ImageInfoArray[e];
            return null;
        }, Ue.Elem.Images.Image = function(A, e, o, i, C) {
            this.type = A, this.size = e, this.width = o, this.height = i, this.url = C;
        }, Ue.Elem.Images.Image.prototype.getType = function() {
            return this.type;
        }, Ue.Elem.Images.Image.prototype.getSize = function() {
            return this.size;
        }, Ue.Elem.Images.Image.prototype.getWidth = function() {
            return this.width;
        }, Ue.Elem.Images.Image.prototype.getHeight = function() {
            return this.height;
        }, Ue.Elem.Images.Image.prototype.getUrl = function() {
            return this.url;
        }, Ue.Elem.Sound = function(A, e, o, i, C, g, E) {
            this.uuid = A, this.second = e, this.size = o, this.senderId = i, this.receiverId = C, 
            this.downFlag = g, this.busiId = E == Q.C2C ? 2 : 1, void 0 !== g && void 0 !== busiId ? aA(A, i, 0, g, C, this.busiId, a.SOUND) : this.downUrl = cA(A, i);
        }, Ue.Elem.Sound.prototype.getUUID = function() {
            return this.uuid;
        }, Ue.Elem.Sound.prototype.getSecond = function() {
            return this.second;
        }, Ue.Elem.Sound.prototype.getSize = function() {
            return this.size;
        }, Ue.Elem.Sound.prototype.getSenderId = function() {
            return this.senderId;
        }, Ue.Elem.Sound.prototype.getDownUrl = function() {
            return this.downUrl;
        }, Ue.Elem.Sound.prototype.toHtml = function() {
            return "ie" == E.type && parseInt(E.ver) <= 8 ? "[这是一条语音消息]demo暂不支持ie8(含)以下浏览器播放语音,语音URL:" + this.downUrl : '<audio id="uuid_' + this.uuid + '" src="' + this.downUrl + '" controls="controls" onplay="onChangePlayAudio(this)" preload="none"></audio>';
        }, Ue.Elem.File = function(A, e, o, i, C, g, E) {
            this.uuid = A, this.name = e, this.size = o, this.senderId = i, this.receiverId = C, 
            this.downFlag = g, this.busiId = E == Q.C2C ? 2 : 1, void 0 !== g && void 0 !== busiId ? aA(A, i, 0, g, C, this.busiId, a.FILE) : this.downUrl = PA(A, i, e);
        }, Ue.Elem.File.prototype.getUUID = function() {
            return this.uuid;
        }, Ue.Elem.File.prototype.getName = function() {
            return this.name;
        }, Ue.Elem.File.prototype.getSize = function() {
            return this.size;
        }, Ue.Elem.File.prototype.getSenderId = function() {
            return this.senderId;
        }, Ue.Elem.File.prototype.getDownUrl = function() {
            return this.downUrl;
        }, Ue.Elem.File.prototype.getDownFlag = function() {
            return this.downFlag;
        }, Ue.Elem.File.prototype.toHtml = function() {
            var A, e;
            return A = this.size, e = "Byte", this.size >= 1024 && (A = Math.round(this.size / 1024), 
            e = "KB"), '<a href="javascript" onclick="webim.onDownFile("' + this.uuid + '")" title="点击下载文件" ><i class="glyphicon glyphicon-file">&nbsp;' + this.name + "(" + A + e + ")</i></a>";
        }, Ue.Elem.GroupTip = function(A, e, o, i, C) {
            this.opType = A, this.opUserId = e, this.groupId = o, this.groupName = i, this.userIdList = C || [], 
            this.groupInfoList = [], this.memberInfoList = [], this.groupMemberNum = null;
        }, Ue.Elem.GroupTip.prototype.addGroupInfo = function(A) {
            this.groupInfoList.push(A);
        }, Ue.Elem.GroupTip.prototype.addMemberInfo = function(A) {
            this.memberInfoList.push(A);
        }, Ue.Elem.GroupTip.prototype.getOpType = function() {
            return this.opType;
        }, Ue.Elem.GroupTip.prototype.getOpUserId = function() {
            return this.opUserId;
        }, Ue.Elem.GroupTip.prototype.getGroupId = function() {
            return this.groupId;
        }, Ue.Elem.GroupTip.prototype.getGroupName = function() {
            return this.groupName;
        }, Ue.Elem.GroupTip.prototype.getUserIdList = function() {
            return this.userIdList;
        }, Ue.Elem.GroupTip.prototype.getGroupInfoList = function() {
            return this.groupInfoList;
        }, Ue.Elem.GroupTip.prototype.getMemberInfoList = function() {
            return this.memberInfoList;
        }, Ue.Elem.GroupTip.prototype.getGroupMemberNum = function() {
            return this.groupMemberNum;
        }, Ue.Elem.GroupTip.prototype.setGroupMemberNum = function(A) {
            return this.groupMemberNum = A;
        }, Ue.Elem.GroupTip.prototype.toHtml = function() {
            var A = "[群提示消息]";
            switch (this.opType) {
              case S.JOIN:
                A += this.opUserId + "邀请了";
                for (var e in this.userIdList) if (A += this.userIdList[e] + ",", this.userIdList.length > 10 && 9 == e) {
                    A += "等" + this.userIdList.length + "人";
                    break;
                }
                A += "加入该群";
                break;

              case S.QUIT:
                A += this.opUserId + "主动退出该群";
                break;

              case S.KICK:
                A += this.opUserId + "将";
                for (var e in this.userIdList) if (A += this.userIdList[e] + ",", this.userIdList.length > 10 && 9 == e) {
                    A += "等" + this.userIdList.length + "人";
                    break;
                }
                A += "踢出该群";
                break;

              case S.SET_ADMIN:
                A += this.opUserId + "将";
                for (var e in this.userIdList) if (A += this.userIdList[e] + ",", this.userIdList.length > 10 && 9 == e) {
                    A += "等" + this.userIdList.length + "人";
                    break;
                }
                A += "设为管理员";
                break;

              case S.CANCEL_ADMIN:
                A += this.opUserId + "取消";
                for (var e in this.userIdList) if (A += this.userIdList[e] + ",", this.userIdList.length > 10 && 9 == e) {
                    A += "等" + this.userIdList.length + "人";
                    break;
                }
                A += "的管理员资格";
                break;

              case S.MODIFY_GROUP_INFO:
                A += this.opUserId + "修改了群资料：";
                for (var e in this.groupInfoList) {
                    var o = this.groupInfoList[e].getType(), i = this.groupInfoList[e].getValue();
                    switch (o) {
                      case K.FACE_URL:
                        A += "群头像为" + i + "; ";
                        break;

                      case K.NAME:
                        A += "群名称为" + i + "; ";
                        break;

                      case K.OWNER:
                        A += "群主为" + i + "; ";
                        break;

                      case K.NOTIFICATION:
                        A += "群公告为" + i + "; ";
                        break;

                      case K.INTRODUCTION:
                        A += "群简介为" + i + "; ";
                        break;

                      default:
                        A += "未知信息为:type=" + o + ",value=" + i + "; ";
                    }
                }
                break;

              case S.MODIFY_MEMBER_INFO:
                A += this.opUserId + "修改了群成员资料:";
                for (var e in this.memberInfoList) {
                    var C = this.memberInfoList[e].getUserId(), g = this.memberInfoList[e].getShutupTime();
                    if (A += C + ": ", A += null != g && void 0 !== g ? 0 == g ? "取消禁言; " : "禁言" + g + "秒; " : " shutupTime为空", 
                    this.memberInfoList.length > 10 && 9 == e) {
                        A += "等" + this.memberInfoList.length + "人";
                        break;
                    }
                }
                break;

              case S.READED:
                Log.info("消息已读同步");
                break;

              default:
                A += "未知群提示消息类型：type=" + this.opType;
            }
            return A;
        }, Ue.Elem.GroupTip.GroupInfo = function(A, e) {
            this.type = A, this.value = e;
        }, Ue.Elem.GroupTip.GroupInfo.prototype.getType = function() {
            return this.type;
        }, Ue.Elem.GroupTip.GroupInfo.prototype.getValue = function() {
            return this.value;
        }, Ue.Elem.GroupTip.MemberInfo = function(A, e) {
            this.userId = A, this.shutupTime = e;
        }, Ue.Elem.GroupTip.MemberInfo.prototype.getUserId = function() {
            return this.userId;
        }, Ue.Elem.GroupTip.MemberInfo.prototype.getShutupTime = function() {
            return this.shutupTime;
        }, Ue.Elem.Custom = function(A, e, o) {
            this.data = A, this.desc = e, this.ext = o;
        }, Ue.Elem.Custom.prototype.getData = function() {
            return this.data;
        }, Ue.Elem.Custom.prototype.getDesc = function() {
            return this.desc;
        }, Ue.Elem.Custom.prototype.getExt = function() {
            return this.ext;
        }, Ue.Elem.Custom.prototype.toHtml = function() {
            return this.data;
        };
        var Oe = new function() {
            var A = {}, o = [];
            e = {}, this.cookie = "", this.syncFlag = 0;
            var i = function(e) {
                for (var o in A) e(A[o]);
            }, C = function(A) {
                var o = !1, i = A.sess._impl.skey, C = A.isSend + A.seq + A.random;
                return e[i] && e[i][C] && (o = !0), e[i] ? e[i][C] = {
                    time: A.time
                } : (e[i] = {}, e[i][C] = {
                    time: A.time
                }), o;
            };
            this.sessMap = function() {
                return A;
            }, this.sessCount = function() {
                return o.length;
            }, this.sessByTypeId = function(e, o) {
                var i = Se.skey(e, o);
                return void 0 === i || null == i ? null : A[i];
            }, this.delSessByTypeId = function(o, i) {
                var C = Se.skey(o, i);
                return void 0 !== C && null != C && (A[C] && (delete A[C], delete e[C]), !0);
            }, this.resetCookieAndSyncFlag = function() {
                this.cookie = "", this.syncFlag = 0;
            }, this.setAutoRead = function(A, e, o) {
                if (o && i(function(A) {
                    A._impl.isAutoRead = !1;
                }), A && (A._impl.isAutoRead = e, e)) if (A._impl.unread = 0, A._impl.type == Q.C2C) {
                    var C = [];
                    C.push(new Ke(A._impl.id, A._impl.time)), pA(Oe.cookie, C, function(A) {
                        nA.info("[setAutoRead]: c2CMsgReaded success");
                    }, function(A) {
                        nA.error("[setAutoRead}: c2CMsgReaded failed:" + A.ErrorInfo);
                    });
                } else if (A._impl.type == Q.GROUP) {
                    var g = {
                        GroupId: A._impl.id,
                        MsgReadedSeq: A._impl.curMaxMsgSeq
                    };
                    ge(g, function(A) {
                        nA.info("groupMsgReaded success");
                    }, function(A) {
                        nA.error("groupMsgReaded failed:" + A.ErrorInfo);
                    });
                }
            }, this.c2CMsgReaded = function(A, e, o) {
                var i = [];
                i.push(new Ke(A.To_Account, A.LastedMsgTime)), pA(Oe.cookie, i, function(A) {
                    e && (nA.info("c2CMsgReaded success"), e(A));
                }, function(A) {
                    o && (nA.error("c2CMsgReaded failed:" + A.ErrorInfo), o(A));
                });
            }, this.addSession = function(e) {
                A[e._impl.skey] = e;
            }, this.delSession = function(e) {
                delete A[e._impl.skey];
            }, this.addMsg = function(e) {
                if (C(e)) return !1;
                var o = e.sess;
                return A[o._impl.skey] || this.addSession(o), o._impl_addMsg(e), !0;
            }, this.updateTimeline = function() {
                var A = new Array();
                i(function(e) {
                    A.push(e);
                }), A.sort(function(A, e) {
                    return e.time - A.time;
                }), o = A;
            };
        }(), pe = new function() {
            var A = null, e = null, o = {
                1: null,
                2: null,
                3: null,
                4: null,
                5: null,
                6: null,
                7: null,
                8: null,
                9: null,
                10: null,
                11: null,
                15: null,
                255: null,
                12: null
            }, i = {
                1: null,
                2: null,
                3: null,
                4: null,
                5: null,
                6: null,
                7: null,
                8: null
            }, C = {
                1: null
            }, g = !1, E = 0, I = 0, n = null, t = !1, B = 0, s = 90, r = null, D = {}, f = {
                92: null,
                96: null
            }, c = null, P = null, a = 0, G = {}, h = {};
            this.setLongPollingOn = function(A) {
                g = A;
            }, this.getLongPollingOn = function() {
                return g;
            }, this.resetLongPollingInfo = function() {
                g = !1, E = 0, I = 0;
            }, this.setBigGroupLongPollingOn = function(A) {
                t = A;
            }, this.setBigGroupLongPollingKey = function(A) {
                r = A;
            }, this.resetBigGroupLongPollingInfo = function() {
                t = !1, B = 0, r = null, D = {};
            }, this.setBigGroupLongPollingMsgMap = function(A, e) {
                var o = D[A];
                o ? (o = parseInt(o) + e, D[A] = o) : D[A] = e;
            }, this.clear = function() {
                e = null, o = {
                    1: null,
                    2: null,
                    3: null,
                    4: null,
                    5: null,
                    6: null,
                    7: null,
                    8: null,
                    9: null,
                    10: null,
                    11: null,
                    15: null,
                    255: null,
                    12: null
                }, i = {
                    1: null,
                    2: null,
                    3: null,
                    4: null,
                    5: null,
                    6: null,
                    7: null,
                    8: null
                }, C = {
                    1: null
                }, A = null, g = !1, E = 0, I = 0, n = null, t = !1, B = 0, r = null, D = {}, h = {}, 
                b = [], q = null, V = null;
            };
            var J = function(A, e) {
                ue(function(e) {
                    b = e.IpList, q = e.AuthKey, V = e.ExpireTime, A && A(e);
                }, function(A) {
                    nA.error("initIpAndAuthkey failed:" + A.ErrorInfo), e && e(A);
                });
            }, m = function(A, e) {
                var o = {
                    Member_Account: Z.identifier,
                    Limit: 1e3,
                    Offset: 0,
                    GroupBaseInfoFilter: [ "NextMsgSeq" ]
                };
                Ae(o, function(e) {
                    if (!e.GroupIdList || 0 == e.GroupIdList.length) return nA.info("initMyGroupMaxSeqs: 目前还没有加入任何群组"), 
                    void (A && A(e));
                    for (var o = 0; o < e.GroupIdList.length; o++) {
                        var i = e.GroupIdList[o].GroupId, C = e.GroupIdList[o].NextMsgSeq - 1;
                        G[i] = C;
                    }
                    A && A(e);
                }, function(A) {
                    nA.error("initMyGroupMaxSeqs failed:" + A.ErrorInfo), e && e(A);
                });
            }, v = function(A, e, o) {
                a++;
                var i = {
                    GroupId: A,
                    ReqMsgSeq: e,
                    ReqMsgNumber: o
                };
                nA.warn("第" + a + "次补齐群消息,参数=" + JSON.stringify(i)), pe.syncGroupMsgs(i);
            }, x = function(A, e) {
                var o = G[A];
                o ? e > o && (G[A] = e) : G[A] = e;
            }, j = function(A, e) {
                for (var o in A) {
                    var i = A[o];
                    if (i.From_Account) {
                        var C = EA(i, !1, !0);
                        C && e.push(C), x(i.ToGroupId, i.MsgSeq);
                    }
                }
                return e;
            }, z = function(e, o) {
                var i = {}, C = [];
                for (var g in o) {
                    var E = i[o[g].ToGroupId];
                    E || (E = i[o[g].ToGroupId] = {
                        min: 99999999,
                        max: -1,
                        msgs: []
                    }), o[g].NoticeSeq > I && (nA.warn("noticeSeq=" + I + ",msgNoticeSeq=" + o[g].NoticeSeq), 
                    I = o[g].NoticeSeq), o[g].Event = e, i[o[g].ToGroupId].msgs.push(o[g]), o[g].MsgSeq < E.min && (i[o[g].ToGroupId].min = o[g].MsgSeq), 
                    o[g].MsgSeq > E.max && (i[o[g].ToGroupId].max = o[g].MsgSeq);
                }
                for (var n in i) {
                    var t = i[n].max - i[n].min + 1, Q = G[n];
                    Q ? i[n].min - Q > 1 || i[n].msgs.length < t ? (nA.warn("发起一次补齐群消息请求,curMaxMsgSeq=" + Q + ", minMsgSeq=" + i[n].min + ", maxMsgSeq=" + i[n].max + ", msgs.length=" + i[n].msgs.length + ", tempCount=" + t), 
                    v(n, i[n].max, i[n].max - Q), x(n, i[n].max)) : C = j(i[n].msgs, C) : (nA.warn("不存在该群的最大消息seq，群id=" + n), 
                    i[n].msgs.length < t ? (nA.warn("发起一次补齐群消息请求,minMsgSeq=" + i[n].min + ", maxMsgSeq=" + i[n].max + ", msgs.length=" + i[n].msgs.length + ", tempCount=" + t), 
                    v(n, i[n].max, t), x(n, i[n].max)) : C = j(i[n].msgs, C));
                }
                C.length && Oe.updateTimeline(), A && C.length && A(C);
            }, W = function(e, o) {
                var i = {}, C = [];
                for (var g in o) {
                    var E = i[o[g].ToGroupId];
                    E || (E = i[o[g].ToGroupId] = {
                        min: 99999999,
                        max: -1,
                        msgs: []
                    }), o[g].NoticeSeq > I && (nA.warn("noticeSeq=" + I + ",msgNoticeSeq=" + o[g].NoticeSeq), 
                    I = o[g].NoticeSeq), o[g].Event = e, i[o[g].ToGroupId].msgs.push(o[g]), o[g].MsgSeq < E.min && (i[o[g].ToGroupId].min = o[g].MsgSeq), 
                    o[g].MsgSeq > E.max && (i[o[g].ToGroupId].max = o[g].MsgSeq);
                }
                for (var n in i) {
                    var t = i[n].max - i[n].min + 1, Q = G[n];
                    Q ? i[n].min - Q > 1 || i[n].msgs.length < t ? (nA.warn("发起一次补齐群消息请求,curMaxMsgSeq=" + Q + ", minMsgSeq=" + i[n].min + ", maxMsgSeq=" + i[n].max + ", msgs.length=" + i[n].msgs.length + ", tempCount=" + t), 
                    v(n, i[n].max, i[n].max - Q), x(n, i[n].max)) : C = j(i[n].msgs, C) : (nA.warn("不存在该群的最大消息seq，群id=" + n), 
                    i[n].msgs.length < t ? (nA.warn("发起一次补齐群消息请求,minMsgSeq=" + i[n].min + ", maxMsgSeq=" + i[n].max + ", msgs.length=" + i[n].msgs.length + ", tempCount=" + t), 
                    v(n, i[n].max, t), x(n, i[n].max)) : C = j(i[n].msgs, C));
                }
                C.length && Oe.updateTimeline(), A && C.length && A(C);
            }, X = function(A, e) {
                for (var i in A) {
                    var C = A[i], g = C.MsgBody, E = g.ReportType;
                    0 == e && C.NoticeSeq && C.NoticeSeq > I && (I = C.NoticeSeq);
                    C.GroupInfo.To_Account;
                    if (e) {
                        var n = C.ToGroupId + "_" + E + "_" + g.Operator_Account;
                        if (h[n]) {
                            nA.warn("收到重复的群系统消息：key=" + n);
                            continue;
                        }
                        h[n] = !0;
                    }
                    var t = {
                        SrcFlag: 0,
                        ReportType: E,
                        GroupId: C.ToGroupId,
                        GroupName: C.GroupInfo.GroupName,
                        Operator_Account: g.Operator_Account,
                        MsgTime: C.MsgTimeStamp,
                        groupReportTypeMsg: g
                    };
                    switch (E) {
                      case U.JOIN_GROUP_REQUEST:
                        t.RemarkInfo = g.RemarkInfo, t.MsgKey = g.MsgKey, t.Authentication = g.Authentication, 
                        t.UserDefinedField = C.UserDefinedField, t.From_Account = C.From_Account, t.MsgSeq = C.ClientSeq, 
                        t.MsgRandom = C.MsgRandom;
                        break;

                      case U.JOIN_GROUP_ACCEPT:
                      case U.JOIN_GROUP_REFUSE:
                        t.RemarkInfo = g.RemarkInfo;
                        break;

                      case U.KICK:
                      case U.DESTORY:
                      case U.CREATE:
                      case U.INVITED_JOIN_GROUP_REQUEST:
                      case U.INVITED_JOIN_GROUP_REQUEST_AGREE:
                      case U.QUIT:
                      case U.SET_ADMIN:
                      case U.CANCEL_ADMIN:
                      case U.REVOKE:
                      case U.READED:
                        break;

                      case U.CUSTOM:
                        t.MsgSeq = C.MsgSeq, t.UserDefinedField = g.UserDefinedField;
                        break;

                      default:
                        nA.error("未知群系统消息类型：reportType=" + E);
                    }
                    if (e) E == U.JOIN_GROUP_REQUEST && o[E] && o[E](t); else if (o[E]) if (E == U.READED) for (var Q = t.groupReportTypeMsg.GroupReadInfoArray, B = 0, s = Q.length; B < s; B++) {
                        var M = Q[B];
                        o[E](M);
                    } else o[E](t);
                }
            }, _ = function(A, e) {
                var o, C, g;
                for (var E in A) {
                    switch (o = A[E], C = o.PushType, 0 == e && o.NoticeSeq && o.NoticeSeq > I && (I = o.NoticeSeq), 
                    g = {
                        Type: C
                    }, C) {
                      case O.FRIEND_ADD:
                        g.Accounts = o.FriendAdd_Account;
                        break;

                      case O.FRIEND_DELETE:
                        g.Accounts = o.FriendDel_Account;
                        break;

                      case O.PENDENCY_ADD:
                        g.PendencyList = o.PendencyAdd;
                        break;

                      case O.PENDENCY_DELETE:
                        g.Accounts = o.FrienPencydDel_Account;
                        break;

                      case O.BLACK_LIST_ADD:
                        g.Accounts = o.BlackListAdd_Account;
                        break;

                      case O.BLACK_LIST_DELETE:
                        g.Accounts = o.BlackListDel_Account;
                        break;

                      default:
                        nA.error("未知好友系统通知类型：friendNotice=" + JSON.stringify(o));
                    }
                    e ? C == O.PENDENCY_ADD && i[C] && i[C](g) : i[C] && i[C](g);
                }
            }, $ = function(A, e) {
                var o, i, g;
                for (var E in A) {
                    switch (o = A[E], i = o.PushType, 0 == e && o.NoticeSeq && o.NoticeSeq > I && (I = o.NoticeSeq), 
                    g = {
                        Type: i
                    }, i) {
                      case p.PROFILE_MODIFY:
                        g.Profile_Account = o.Profile_Account, g.ProfileList = o.ProfileList;
                        break;

                      default:
                        nA.error("未知资料系统通知类型：profileNotice=" + JSON.stringify(o));
                    }
                    e ? i == p.PROFILE_MODIFY && C[i] && C[i](g) : C[i] && C[i](g);
                }
            }, AA = function(A) {
                var e = A.MsgBody, i = e.ReportType, C = (A.GroupInfo.To_Account, {
                    SrcFlag: 1,
                    ReportType: i,
                    GroupId: A.ToGroupId,
                    GroupName: A.GroupInfo.GroupName,
                    Operator_Account: e.Operator_Account,
                    MsgTime: A.MsgTimeStamp
                });
                switch (i) {
                  case U.JOIN_GROUP_REQUEST:
                    C.RemarkInfo = e.RemarkInfo, C.MsgKey = e.MsgKey, C.Authentication = e.Authentication, 
                    C.UserDefinedField = A.UserDefinedField, C.From_Account = A.From_Account, C.MsgSeq = A.ClientSeq, 
                    C.MsgRandom = A.MsgRandom;
                    break;

                  case U.JOIN_GROUP_ACCEPT:
                  case U.JOIN_GROUP_REFUSE:
                    C.RemarkInfo = e.RemarkInfo;
                    break;

                  case U.KICK:
                  case U.DESTORY:
                  case U.CREATE:
                  case U.INVITED_JOIN_GROUP_REQUEST:
                  case U.INVITED_JOIN_GROUP_REQUEST_AGREE:
                  case U.QUIT:
                  case U.SET_ADMIN:
                  case U.CANCEL_ADMIN:
                  case U.REVOKE:
                    break;

                  case U.CUSTOM:
                    C.MsgSeq = A.MsgSeq, C.UserDefinedField = e.UserDefinedField;
                    break;

                  default:
                    nA.error("未知群系统消息类型：reportType=" + i);
                }
                o[i] && o[i](C);
            }, eA = function(A) {
                for (var e = 0, o = A.length; e < o; e++) oA(A[e]);
            }, oA = function(A) {
                var e = A.SubMsgType;
                switch (e) {
                  case F.READED:
                    if (A.ReadC2cMsgNotify.UinPairReadArray && f[e]) for (var o = 0, i = A.ReadC2cMsgNotify.UinPairReadArray.length; o < i; o++) {
                        var C = A.ReadC2cMsgNotify.UinPairReadArray[o];
                        f[e](C);
                    }
                    break;

                  case F.KICKEDOUT:
                    f[e] && f[e]();
                    break;

                  default:
                    nA.error("未知C2c系统消息：subType=" + e);
                }
            };
            this.longPolling = function(A, e) {
                function o() {
                    KA(i, function(A) {
                        for (var e in A.EventArray) {
                            var o = A.EventArray[e];
                            switch (o.Event) {
                              case u.C2C:
                                E = o.NotifySeq, nA.warn("longpolling: received new c2c msg"), pe.syncMsgs();
                                break;

                              case u.GROUP_COMMON:
                                nA.warn("longpolling: received new group msgs"), W(o.Event, o.GroupMsgArray);
                                break;

                              case u.GROUP_TIP:
                              case u.GROUP_TIP2:
                                nA.warn("longpolling: received new group tips"), W(o.Event, o.GroupTips);
                                break;

                              case u.GROUP_SYSTEM:
                                nA.warn("longpolling: received new group system msgs"), X(o.GroupTips, !1);
                                break;

                              case u.FRIEND_NOTICE:
                                nA.warn("longpolling: received new friend system notice"), _(o.FriendListMod, !1);
                                break;

                              case u.PROFILE_NOTICE:
                                nA.warn("longpolling: received new profile system notice"), $(o.ProfileDataMod, !1);
                                break;

                              case u.C2C_COMMON:
                                I = o.C2cMsgArray[0].NoticeSeq, nA.warn("longpolling: received new c2c_common msg", I), 
                                z(o.Event, o.C2cMsgArray);
                                break;

                              case u.C2C_EVENT:
                                I = o.C2cNotifyMsgArray[0].NoticeSeq, nA.warn("longpolling: received new c2c_event msg"), 
                                eA(o.C2cNotifyMsgArray);
                                break;

                              default:
                                nA.error("longpolling收到未知新消息类型: Event=" + o.Event);
                            }
                        }
                        var i = {
                            ActionStatus: M.OK,
                            ErrorCode: 0
                        };
                        iA(i);
                    }, function(A) {
                        iA(A), e && e(A);
                    });
                }
                var i = {
                    Timeout: L / 1e3,
                    Cookie: {
                        NotifySeq: E,
                        NoticeSeq: I
                    }
                };
                y ? (i.Cookie.LongPollingId = y, o()) : Fe(0, function(A) {
                    y = i.Cookie.LongPollingId = A.LongPollingId, L = A.Timeout > 60 ? L : 1e3 * A.Timeout, 
                    o();
                });
            }, this.bigGroupLongPolling = function(A, e) {
                UA({
                    StartSeq: B,
                    HoldTime: s,
                    Key: r
                }, function(e) {
                    var o = [];
                    if (B = e.NextSeq, s = e.HoldTime, r = e.Key, e.RspMsgList && e.RspMsgList.length > 0) {
                        for (var i, C, g, E = 0, I = e.RspMsgList.length - 1; I >= 0; I--) if (!(i = e.RspMsgList[I]).IsPlaceMsg && i.From_Account && i.MsgBody && 0 != i.MsgBody.length) switch (C = i.Event) {
                          case u.GROUP_COMMON:
                            nA.info("bigGroupLongPolling: return new group msg"), (g = EA(i, !1, !1)) && o.push(g), 
                            E += 1;
                            break;

                          case u.GROUP_TIP:
                          case u.GROUP_TIP2:
                            nA.info("bigGroupLongPolling: return new group tip"), (g = EA(i, !1, !1)) && o.push(g);
                            break;

                          case u.GROUP_SYSTEM:
                            nA.info("bigGroupLongPolling: new group system msg"), AA(i);
                            break;

                          default:
                            nA.error("bigGroupLongPolling收到未知新消息类型: Event=" + C);
                        }
                        E > 0 && (pe.setBigGroupLongPollingMsgMap(i.ToGroupId, E), nA.warn("current bigGroupLongPollingMsgMap: " + JSON.stringify(D)));
                    }
                    T = 0;
                    var Q = {
                        ActionStatus: M.OK,
                        ErrorCode: Y.ON,
                        ErrorInfo: "connection is ok..."
                    };
                    Re.callBack(Q), A ? A(o) : n && n(o), t && pe.bigGroupLongPolling();
                }, function(A) {
                    if (60008 != A.ErrorCode && (nA.error(A.ErrorInfo), T++), 91101 == A.ErrorCode && (nA.error("多实例登录，被kick"), 
                    c && c()), T < 10) t && pe.bigGroupLongPolling(); else {
                        var o = {
                            ActionStatus: M.FAIL,
                            ErrorCode: Y.OFF,
                            ErrorInfo: "connection is off"
                        };
                        Re.callBack(o);
                    }
                    e && e(A);
                }, 1e3 * s);
            };
            var iA = function(A) {
                if (0 == A.ErrorCode || 60008 == A.ErrorCode) {
                    H = 0, d = !1;
                    var e, o = !1;
                    switch (N) {
                      case Y.INIT:
                        o = !0, N = Y.ON, e = "create connection successfully(INIT->ON)";
                        break;

                      case Y.ON:
                        e = "connection is on...(ON->ON)";
                        break;

                      case Y.RECONNECT:
                        N = Y.ON, e = "connection is on...(RECONNECT->ON)";
                        break;

                      case Y.OFF:
                        o = !0, N = Y.RECONNECT, e = "reconnect successfully(OFF->RECONNECT)";
                    }
                    var i = {
                        ActionStatus: M.OK,
                        ErrorCode: N,
                        ErrorInfo: e
                    };
                    o && Re.callBack(i), g && pe.longPolling();
                } else if (91101 == A.ErrorCode) nA.error("多实例登录，被kick"), c && c(); else if (H++, 
                nA.warn("longPolling接口第" + H + "次报错: " + A.ErrorInfo), H <= 10) setTimeout(CA, 100); else {
                    N = Y.OFF;
                    var C = {
                        ActionStatus: M.FAIL,
                        ErrorCode: Y.OFF,
                        ErrorInfo: "connection is off"
                    };
                    0 == d && Re.callBack(C), d = !0, nA.warn("5000毫秒之后,SDK会发起新的longPolling请求..."), 
                    setTimeout(CA, 5e3);
                }
            }, z = function(e, o) {
                var i = [], C = [];
                C = o;
                for (var g in C) {
                    var E, I, n, t = C[g];
                    t.From_Account == Z.identifier ? (E = !0, I = t.To_Account, n = "") : (E = !1, I = t.From_Account, 
                    n = "");
                    var B = Oe.sessByTypeId(Q.C2C, I);
                    B || (B = new Se(Q.C2C, I, I, n, 0, 0));
                    var s = new Ue(B, E, t.MsgSeq, t.MsgRandom, t.MsgTimeStamp, t.From_Account), M = null, r = null, D = null;
                    for (var f in t.MsgBody) {
                        switch (M = t.MsgBody[f], D = M.MsgType) {
                          case w.TEXT:
                            r = new Ue.Elem.Text(M.MsgContent.Text);
                            break;

                          case w.FACE:
                            r = new Ue.Elem.Face(M.MsgContent.Index, M.MsgContent.Data);
                            break;

                          case w.IMAGE:
                            r = new Ue.Elem.Images(M.MsgContent.UUID, M.MsgContent.ImageFormat || "");
                            for (var c in M.MsgContent.ImageInfoArray) {
                                var P = M.MsgContent.ImageInfoArray[c];
                                r.addImage(new Ue.Elem.Images.Image(P.Type, P.Size, P.Width, P.Height, P.URL));
                            }
                            break;

                          case w.SOUND:
                            M.MsgContent ? r = new Ue.Elem.Sound(M.MsgContent.UUID, M.MsgContent.Second, M.MsgContent.Size, t.From_Account, t.To_Account, M.MsgContent.Download_Flag, Q.C2C) : (D = w.TEXT, 
                            r = new Ue.Elem.Text("[语音消息]下载地址解析出错"));
                            break;

                          case w.LOCATION:
                            r = new Ue.Elem.Location(M.MsgContent.Longitude, M.MsgContent.Latitude, M.MsgContent.Desc);
                            break;

                          case w.FILE:
                          case w.FILE + " ":
                            D = w.FILE, M.MsgContent ? r = new Ue.Elem.File(M.MsgContent.UUID, M.MsgContent.FileName, M.MsgContent.FileSize, t.From_Account, t.To_Account, M.MsgContent.Download_Flag, Q.C2C) : (D = w.TEXT, 
                            r = new Ue.Elem.Text("[文件消息下载地址解析出错]"));
                            break;

                          case w.CUSTOM:
                            try {
                                var a = JSON.parse(M.MsgContent.Data);
                                if (a && a.userAction && a.userAction == k.ING) continue;
                            } catch (A) {}
                            D = w.CUSTOM, r = new Ue.Elem.Custom(M.MsgContent.Data, M.MsgContent.Desc, M.MsgContent.Ext);
                            break;

                          default:
                            D = w.TEXT, r = new Ue.Elem.Text("web端暂不支持" + M.MsgType + "消息");
                        }
                        s.elems.push(new Ue.Elem(D, r));
                    }
                    s.elems.length > 0 && Oe.addMsg(s) && i.push(s);
                }
                i.length > 0 && Oe.updateTimeline(), i.length > 0 && A && A(i);
            }, CA = function() {
                g && pe.longPolling();
            }, gA = function(A) {
                for (var e in A) {
                    var o = A[e];
                    switch (X(o.GroupTips, !0), o.Event) {
                      case u.GROUP_SYSTEM:
                        nA.warn("handlerApplyJoinGroupSystemMsgs： handler new group system msg"), X(o.GroupTips, !0);
                        break;

                      default:
                        nA.error("syncMsgs收到未知的群系统消息类型: Event=" + o.Event);
                    }
                }
            };
            this.syncMsgs = function(e, o) {
                var i = [], C = [];
                OA(Oe.cookie, Oe.syncFlag, function(o) {
                    2 == o.SyncFlag && (Oe.syncFlag = 0), C = o.MsgList, Oe.cookie = o.Cookie;
                    for (var g in C) {
                        var E, I, n, t = C[g];
                        t.From_Account == Z.identifier ? (E = !0, I = t.To_Account, n = "") : (E = !1, I = t.From_Account, 
                        n = "");
                        var B = Oe.sessByTypeId(Q.C2C, I);
                        B || (B = new Se(Q.C2C, I, I, n, 0, 0));
                        var s = new Ue(B, E, t.MsgSeq, t.MsgRandom, t.MsgTimeStamp, t.From_Account), M = null, r = null, D = null;
                        for (var f in t.MsgBody) {
                            switch (M = t.MsgBody[f], D = M.MsgType) {
                              case w.TEXT:
                                r = new Ue.Elem.Text(M.MsgContent.Text);
                                break;

                              case w.FACE:
                                r = new Ue.Elem.Face(M.MsgContent.Index, M.MsgContent.Data);
                                break;

                              case w.IMAGE:
                                r = new Ue.Elem.Images(M.MsgContent.UUID, M.MsgContent.ImageFormat);
                                for (var c in M.MsgContent.ImageInfoArray) {
                                    var P = M.MsgContent.ImageInfoArray[c];
                                    r.addImage(new Ue.Elem.Images.Image(P.Type, P.Size, P.Width, P.Height, P.URL));
                                }
                                break;

                              case w.SOUND:
                                M.MsgContent ? r = new Ue.Elem.Sound(M.MsgContent.UUID, M.MsgContent.Second, M.MsgContent.Size, t.From_Account, t.To_Account, M.MsgContent.Download_Flag, Q.C2C) : (D = w.TEXT, 
                                r = new Ue.Elem.Text("[语音消息]下载地址解析出错"));
                                break;

                              case w.LOCATION:
                                r = new Ue.Elem.Location(M.MsgContent.Longitude, M.MsgContent.Latitude, M.MsgContent.Desc);
                                break;

                              case w.FILE:
                              case w.FILE + " ":
                                D = w.FILE, M.MsgContent ? r = new Ue.Elem.File(M.MsgContent.UUID, M.MsgContent.FileName, M.MsgContent.FileSize, t.From_Account, t.To_Account, M.MsgContent.Download_Flag, Q.C2C) : (D = w.TEXT, 
                                r = new Ue.Elem.Text("[文件消息下载地址解析出错]"));
                                break;

                              case w.CUSTOM:
                                try {
                                    var a = JSON.parse(M.MsgContent.Data);
                                    if (a && a.userAction && a.userAction == k.ING) continue;
                                } catch (A) {}
                                D = w.CUSTOM, r = new Ue.Elem.Custom(M.MsgContent.Data, M.MsgContent.Desc, M.MsgContent.Ext);
                                break;

                              default:
                                D = w.TEXT, r = new Ue.Elem.Text("web端暂不支持" + M.MsgType + "消息");
                            }
                            s.elems.push(new Ue.Elem(D, r));
                        }
                        s.elems.length > 0 && Oe.addMsg(s) && i.push(s);
                    }
                    gA(o.EventArray), i.length > 0 && Oe.updateTimeline(), e ? e(i) : i.length > 0 && A && A(i);
                }, function(A) {
                    nA.error("getMsgs failed:" + A.ErrorInfo), o && o(A);
                });
            }, this.getC2CHistoryMsgs = function(A, e, o) {
                if (A.Peer_Account || !o) if (A.MaxCnt || (A.MaxCnt = 15), A.MaxCnt <= 0 && o) o(IA.getReturnError("MaxCnt should be greater than 0", -14)); else if (A.MaxCnt > 15) {
                    if (o) return void o(IA.getReturnError("MaxCnt can not be greater than 15", -15));
                } else {
                    null != A.MsgKey && void 0 !== A.MsgKey || (A.MsgKey = "");
                    var i = {
                        Peer_Account: A.Peer_Account,
                        MaxCnt: A.MaxCnt,
                        LastMsgTime: A.LastMsgTime,
                        MsgKey: A.MsgKey
                    };
                    YA(i, function(o) {
                        var i = [], C = [];
                        C = o.MsgList;
                        var g = Oe.sessByTypeId(Q.C2C, A.Peer_Account);
                        g || (g = new Se(Q.C2C, A.Peer_Account, A.Peer_Account, "", 0, 0));
                        for (var E in C) {
                            var I, n = C[E];
                            n.From_Account == Z.identifier ? (I = !0, n.To_Account, "") : (I = !1, n.From_Account, 
                            "");
                            var t = new Ue(g, I, n.MsgSeq, n.MsgRandom, n.MsgTimeStamp, n.From_Account), B = null, s = null, M = null;
                            for (var r in n.MsgBody) {
                                switch (B = n.MsgBody[r], M = B.MsgType) {
                                  case w.TEXT:
                                    s = new Ue.Elem.Text(B.MsgContent.Text);
                                    break;

                                  case w.FACE:
                                    s = new Ue.Elem.Face(B.MsgContent.Index, B.MsgContent.Data);
                                    break;

                                  case w.IMAGE:
                                    s = new Ue.Elem.Images(B.MsgContent.UUID, B.MsgContent.ImageFormat);
                                    for (var D in B.MsgContent.ImageInfoArray) {
                                        var f = B.MsgContent.ImageInfoArray[D];
                                        s.addImage(new Ue.Elem.Images.Image(f.Type, f.Size, f.Width, f.Height, f.URL));
                                    }
                                    break;

                                  case w.SOUND:
                                    B.MsgContent ? s = new Ue.Elem.Sound(B.MsgContent.UUID, B.MsgContent.Second, B.MsgContent.Size, n.From_Account, n.To_Account, B.MsgContent.Download_Flag, Q.C2C) : (M = w.TEXT, 
                                    s = new Ue.Elem.Text("[语音消息]下载地址解析出错"));
                                    break;

                                  case w.LOCATION:
                                    s = new Ue.Elem.Location(B.MsgContent.Longitude, B.MsgContent.Latitude, B.MsgContent.Desc);
                                    break;

                                  case w.FILE:
                                  case w.FILE + " ":
                                    M = w.FILE, B.MsgContent ? s = new Ue.Elem.File(B.MsgContent.UUID, B.MsgContent.FileName, B.MsgContent.FileSize, n.From_Account, n.To_Account, B.MsgContent.Download_Flag, Q.C2C) : (M = w.TEXT, 
                                    s = new Ue.Elem.Text("[文件消息下载地址解析出错]"));
                                    break;

                                  case w.CUSTOM:
                                    M = w.CUSTOM, s = new Ue.Elem.Custom(B.MsgContent.Data, B.MsgContent.Desc, B.MsgContent.Ext);
                                    break;

                                  default:
                                    M = w.TEXT, s = new Ue.Elem.Text("web端暂不支持" + B.MsgType + "消息");
                                }
                                t.elems.push(new Ue.Elem(M, s));
                            }
                            Oe.addMsg(t), i.push(t);
                        }
                        if (Oe.updateTimeline(), e) {
                            var c = {
                                Complete: o.Complete,
                                MsgCount: i.length,
                                LastMsgTime: o.LastMsgTime,
                                MsgKey: o.MsgKey,
                                MsgList: i
                            };
                            g.isFinished(o.Complete), e(c);
                        }
                    }, function(A) {
                        nA.error("getC2CHistoryMsgs failed:" + A.ErrorInfo), o && o(A);
                    });
                } else o(IA.getReturnError("Peer_Account is empty", -13));
            }, this.syncGroupMsgs = function(e, o, i) {
                if (e.ReqMsgSeq <= 0) {
                    if (i) {
                        var C = IA.getReturnError("ReqMsgSeq must be greater than 0", -16);
                        i(C);
                    }
                } else {
                    var g = {
                        GroupId: e.GroupId,
                        ReqMsgSeq: e.ReqMsgSeq,
                        ReqMsgNumber: e.ReqMsgNumber
                    };
                    Ce(g, function(e) {
                        var i = [], C = (e.GroupId, e.RspMsgList), g = e.IsFinished;
                        if (null != C && void 0 !== C) {
                            for (var E = C.length - 1; E >= 0; E--) {
                                var I = C[E];
                                if (!I.IsPlaceMsg && I.From_Account && I.MsgBody && 0 != I.MsgBody.length) {
                                    var n = EA(I, !0, !0, g);
                                    n && i.push(n);
                                }
                            }
                            i.length > 0 && Oe.updateTimeline(), o ? o(i) : i.length > 0 && A && A(i);
                        } else o && o([]);
                    }, function(A) {
                        nA.error("getGroupMsgs failed:" + A.ErrorInfo), i && i(A);
                    });
                }
            };
            var EA = function(A, o, i, C) {
                if (A.IsPlaceMsg || !A.From_Account || !A.MsgBody || 0 == A.MsgBody.length) return null;
                var g, E, I, n, t = A.ToGroupId, B = t;
                A.GroupInfo && A.GroupInfo.GroupName && (B = A.GroupInfo.GroupName), I = A.From_Account, 
                A.GroupInfo && (A.GroupInfo.From_AccountNick && (I = A.GroupInfo.From_AccountNick), 
                n = A.GroupInfo.From_AccountHeadurl ? A.GroupInfo.From_AccountHeadurl : null), A.From_Account == Z.identifier ? (g = !0, 
                A.From_Account, E = "") : (g = !1, A.From_Account, E = "");
                var s = Oe.sessByTypeId(Q.GROUP, t);
                s || (s = new Se(Q.GROUP, t, B, E, 0, 0)), void 0 !== C && s.isFinished(C || 0);
                var M = l.COMMON;
                if (u.GROUP_TIP == A.Event || u.GROUP_TIP2 == A.Event) {
                    M = l.TIP;
                    var r = A.MsgBody;
                    A.MsgBody = [], A.MsgBody.push({
                        MsgType: w.GROUP_TIP,
                        MsgContent: r
                    });
                } else A.MsgPriority && (A.MsgPriority == R.REDPACKET ? M = l.REDPACKET : A.MsgPriority == R.LOVEMSG && (M = l.LOVEMSG));
                var D = new Ue(s, g, A.MsgSeq, A.MsgRandom, A.MsgTimeStamp, A.From_Account, M, I, n), f = null, c = null, P = null;
                for (var a in A.MsgBody) {
                    switch (f = A.MsgBody[a], P = f.MsgType) {
                      case w.TEXT:
                        c = new Ue.Elem.Text(f.MsgContent.Text);
                        break;

                      case w.FACE:
                        c = new Ue.Elem.Face(f.MsgContent.Index, f.MsgContent.Data);
                        break;

                      case w.IMAGE:
                        c = new Ue.Elem.Images(f.MsgContent.UUID, f.MsgContent.ImageFormat || "");
                        for (var G in f.MsgContent.ImageInfoArray) c.addImage(new Ue.Elem.Images.Image(f.MsgContent.ImageInfoArray[G].Type, f.MsgContent.ImageInfoArray[G].Size, f.MsgContent.ImageInfoArray[G].Width, f.MsgContent.ImageInfoArray[G].Height, f.MsgContent.ImageInfoArray[G].URL));
                        break;

                      case w.SOUND:
                        f.MsgContent ? c = new Ue.Elem.Sound(f.MsgContent.UUID, f.MsgContent.Second, f.MsgContent.Size, A.From_Account, A.To_Account, f.MsgContent.Download_Flag, Q.GROUP) : (P = w.TEXT, 
                        c = new Ue.Elem.Text("[语音消息]下载地址解析出错"));
                        break;

                      case w.LOCATION:
                        c = new Ue.Elem.Location(f.MsgContent.Longitude, f.MsgContent.Latitude, f.MsgContent.Desc);
                        break;

                      case w.FILE:
                      case w.FILE + " ":
                        P = w.FILE;
                        PA(f.MsgContent.UUID, A.From_Account, f.MsgContent.FileName);
                        f.MsgContent ? c = new Ue.Elem.File(f.MsgContent.UUID, f.MsgContent.FileName, f.MsgContent.FileSize, A.From_Account, A.To_Account, f.MsgContent.Download_Flag, Q.GROUP) : (P = w.TEXT, 
                        c = new Ue.Elem.Text("[文件消息]地址解析出错"));
                        break;

                      case w.GROUP_TIP:
                        var h = f.MsgContent.OpType;
                        if (c = new Ue.Elem.GroupTip(h, f.MsgContent.Operator_Account, t, A.GroupInfo.GroupName, f.MsgContent.List_Account), 
                        S.JOIN == h || S.QUIT == h) c.setGroupMemberNum(f.MsgContent.MemberNum); else if (S.MODIFY_GROUP_INFO == h) {
                            var F = !1, U = {
                                GroupId: t,
                                GroupFaceUrl: null,
                                GroupName: null,
                                OwnerAccount: null,
                                GroupNotification: null,
                                GroupIntroduction: null
                            }, O = f.MsgContent.MsgGroupNewInfo;
                            if (O.GroupFaceUrl) {
                                var p = new Ue.Elem.GroupTip.GroupInfo(K.FACE_URL, O.GroupFaceUrl);
                                c.addGroupInfo(p), F = !0, U.GroupFaceUrl = O.GroupFaceUrl;
                            }
                            if (O.GroupName) {
                                var J = new Ue.Elem.GroupTip.GroupInfo(K.NAME, O.GroupName);
                                c.addGroupInfo(J), F = !0, U.GroupName = O.GroupName;
                            }
                            if (O.Owner_Account) {
                                var Y = new Ue.Elem.GroupTip.GroupInfo(K.OWNER, O.Owner_Account);
                                c.addGroupInfo(Y), F = !0, U.OwnerAccount = O.Owner_Account;
                            }
                            if (O.GroupNotification) {
                                var m = new Ue.Elem.GroupTip.GroupInfo(K.NOTIFICATION, O.GroupNotification);
                                c.addGroupInfo(m), F = !0, U.GroupNotification = O.GroupNotification;
                            }
                            if (O.GroupIntroduction) {
                                var k = new Ue.Elem.GroupTip.GroupInfo(K.INTRODUCTION, O.GroupIntroduction);
                                c.addGroupInfo(k), F = !0, U.GroupIntroduction = O.GroupIntroduction;
                            }
                            0 == o && F && e && e(U);
                        } else if (S.MODIFY_MEMBER_INFO == h) {
                            var N = f.MsgContent.MsgMemberInfo;
                            for (var d in N) {
                                var H = N[d];
                                c.addMemberInfo(new Ue.Elem.GroupTip.MemberInfo(H.User_Account, H.ShutupTime));
                            }
                        }
                        break;

                      case w.CUSTOM:
                        P = w.CUSTOM, c = new Ue.Elem.Custom(f.MsgContent.Data, f.MsgContent.Desc, f.MsgContent.Ext);
                        break;

                      default:
                        P = w.TEXT, c = new Ue.Elem.Text("web端暂不支持" + f.MsgType + "消息");
                    }
                    D.elems.push(new Ue.Elem(P, c));
                }
                return 0 == i ? D : Oe.addMsg(D) ? D : null;
            };
            this.init = function(E, I, t) {
                if (E.onMsgNotify || nA.warn("listeners.onMsgNotify is empty"), A = E.onMsgNotify, 
                E.onBigGroupMsgNotify ? n = E.onBigGroupMsgNotify : nA.warn("listeners.onBigGroupMsgNotify is empty"), 
                E.onC2cEventNotifys ? f = E.onC2cEventNotifys : nA.warn("listeners.onC2cEventNotifys is empty"), 
                E.onGroupSystemNotifys ? o = E.onGroupSystemNotifys : nA.warn("listeners.onGroupSystemNotifys is empty"), 
                E.onGroupInfoChangeNotify ? e = E.onGroupInfoChangeNotify : nA.warn("listeners.onGroupInfoChangeNotify is empty"), 
                E.onFriendSystemNotifys ? i = E.onFriendSystemNotifys : nA.warn("listeners.onFriendSystemNotifys is empty"), 
                E.onProfileSystemNotifys ? C = E.onProfileSystemNotifys : nA.warn("listeners.onProfileSystemNotifys is empty"), 
                E.onKickedEventCall ? c = E.onKickedEventCall : nA.warn("listeners.onKickedEventCall is empty"), 
                E.onAppliedDownloadUrl ? P = E.onAppliedDownloadUrl : nA.warn("listeners.onAppliedDownloadUrl is empty"), 
                Z.identifier && Z.userSig) m(function(A) {
                    nA.info("initMyGroupMaxSeqs success"), J(function(A) {
                        if (nA.info("initIpAndAuthkey success"), I) {
                            nA.info("login success(have login state))");
                            var e = {
                                ActionStatus: M.OK,
                                ErrorCode: 0,
                                ErrorInfo: "login success"
                            };
                            I(e);
                        }
                        pe.setLongPollingOn(!0), g && pe.longPolling(I);
                    }, t);
                }, t); else if (I) {
                    var Q = {
                        ActionStatus: M.OK,
                        ErrorCode: 0,
                        ErrorInfo: "login success(no login state)"
                    };
                    I(Q);
                }
            }, this.sendMsg = function(A, e, o) {
                SA(A, function(i) {
                    if (A.sess.type() == Q.C2C) {
                        if (!Oe.addMsg(A)) {
                            var C = "sendMsg: addMsg failed!", g = IA.getReturnError(C, -17);
                            return nA.error(C), void (o && o(g));
                        }
                        Oe.updateTimeline();
                    }
                    e && e(i);
                }, function(A) {
                    o && o(A);
                });
            };
        }(), Je = new function() {
            this.fileMd5 = null;
            var A = function(A, e, o) {
                function i() {
                    var e = n * E, o = e + E >= A.size ? A.size : e + E, i = g.call(A, e, o);
                    C.readAsArrayBuffer(i);
                }
                var C = null;
                try {
                    C = new FileReader();
                } catch (A) {
                    if (o) return void o(IA.getReturnError("当前浏览器不支持FileReader", -18));
                }
                var g = File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice;
                if (g || !o) {
                    var E = 2097152, I = Math.ceil(A.size / E), n = 0, t = new SparkMD5();
                    C.onload = function(A) {
                        for (var o = "", C = new Uint8Array(A.target.result), g = C.byteLength, E = 0; E < g; E++) o += String.fromCharCode(C[E]);
                        t.appendBinary(o), ++n < I ? i() : (this.fileMd5 = t.end(), e && e(this.fileMd5));
                    }, i();
                } else o(IA.getReturnError("当前浏览器不支持FileAPI", -19));
            };
            this.submitUploadFileForm = function(A, e, o) {
                function i(A, e) {
                    var o = document.createElement("input");
                    o.type = "hidden", o.name = A, o.value = e, s.appendChild(o);
                }
                function C() {
                    var A;
                    try {
                        A = JSON.parse(r.contentWindow.name) || {};
                    } catch (e) {
                        A = {};
                    }
                    A.ActionStatus ? (r.src = "about:blank", r.parentNode.removeChild(r), r = null, 
                    A.ActionStatus == M.OK ? e && e(A) : o && o(A)) : setTimeout(C, 100);
                }
                var g, E, I = A.formId, n = A.fileId, t = "uploadResultIframe_" + W++, Q = A.To_Account, B = A.businessType, s = document.getElementById(I);
                if (!s) return g = "获取表单对象为空: formId=" + I + "(formId非法)", E = IA.getReturnError(g, -20), 
                void (o && o(E));
                var w = document.getElementById(n);
                if (!w) return g = "获取文件对象为空: fileId=" + n + "(没有选择文件或者fileId非法)", E = IA.getReturnError(g, -21), 
                void (o && o(E));
                w.name = "file";
                var r = document.createElement("iframe");
                r.name = t, r.id = t, r.style.display = "none", document.body.appendChild(r);
                var D, c = "https://pic.tim.qq.com/v4/openpic/" + (D = DA() ? "pic_up" : "pic_up_test") + "?tinyid=" + Z.tinyid + "&a2=" + Z.a2 + "&sdkappid=" + Z.sdkAppID + "&accounttype=" + Z.accountType + "&contenttype=http";
                s.action = c, s.method = "post", s.target = t, i("App_Version", G.APP_VERSION), 
                i("From_Account", Z.identifier), i("To_Account", Q), i("Seq", QA().toString()), 
                i("Timestamp", tA().toString()), i("Random", BA().toString()), i("Busi_Id", B), 
                i("PkgFlag", f.RAW_DATA.toString()), i("Auth_Key", q), i("Server_Ver", G.SERVER_VERSION.toString()), 
                i("File_Type", A.fileType), setTimeout(C, 500), s.submit();
            }, this.uploadFile = function(e, o, i) {
                var C = {
                    init: function(A, e, o) {
                        var i = this;
                        i.file = A.file, i.onProgressCallBack = A.onProgressCallBack, A.abortButton && (A.abortButton.onclick = i.abortHandler), 
                        i.total = i.file.size, i.loaded = 0, i.step = 1105920, i.sliceSize = 0, i.sliceOffset = 0, 
                        i.timestamp = tA(), i.seq = QA(), i.random = BA(), i.fromAccount = Z.identifier, 
                        i.toAccount = A.To_Account, i.fileMd5 = A.fileMd5, i.businessType = A.businessType, 
                        i.fileType = A.fileType, i.cbOk = e, i.cbErr = o, i.reader = new FileReader(), i.blobSlice = File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice, 
                        i.reader.onloadstart = i.onLoadStart, i.reader.onprogress = i.onProgress, i.reader.onabort = i.onAbort, 
                        i.reader.onerror = i.onerror, i.reader.onload = i.onLoad, i.reader.onloadend = i.onLoadEnd;
                    },
                    upload: function() {
                        C.readBlob(0);
                    },
                    onLoadStart: function() {},
                    onProgress: function(A) {
                        var e = C;
                        e.loaded += A.loaded, e.onProgressCallBack && e.onProgressCallBack(e.loaded, e.total);
                    },
                    onAbort: function() {},
                    onError: function() {},
                    onLoad: function(A) {
                        var e = C;
                        if (A.target.readyState == FileReader.DONE) {
                            var o = A.target.result, i = o.indexOf(",");
                            -1 != i && (o = o.substr(i + 1));
                            var g = {
                                From_Account: e.fromAccount,
                                To_Account: e.toAccount,
                                Busi_Id: e.businessType,
                                File_Type: e.fileType,
                                File_Str_Md5: e.fileMd5,
                                PkgFlag: f.BASE64_DATA,
                                File_Size: e.total,
                                Slice_Offset: e.sliceOffset,
                                Slice_Size: e.sliceSize,
                                Slice_Data: o,
                                Seq: e.seq,
                                Timestamp: e.timestamp,
                                Random: e.random
                            }, E = function(A) {
                                if (0 == A.IsFinish) e.loaded = A.Next_Offset, e.loaded < e.total ? e.readBlob(e.loaded) : e.loaded = e.total; else if (e.cbOk) {
                                    var o = {
                                        ActionStatus: A.ActionStatus,
                                        ErrorCode: A.ErrorCode,
                                        ErrorInfo: A.ErrorInfo,
                                        File_UUID: A.File_UUID,
                                        File_Size: A.Next_Offset,
                                        URL_INFO: A.URL_INFO,
                                        Download_Flag: A.Download_Flag
                                    };
                                    e.fileType == a.FILE && (o.URL_INFO = PA(A.File_UUID, Z.identifier, e.file.name)), 
                                    e.cbOk(o);
                                }
                                v = 0;
                            };
                            Ge(g, E, function A(o) {
                                v < 20 ? (v++, setTimeout(function() {
                                    Ge(g, E, A);
                                }, 1e3)) : e.cbErr(o);
                            });
                        }
                    },
                    onLoadEnd: function() {},
                    readBlob: function(A) {
                        var e, o = C, i = o.file, g = A + o.step;
                        g > o.total ? (g = o.total, o.sliceSize = g - A) : o.sliceSize = o.step, o.sliceOffset = A, 
                        e = o.blobSlice.call(i, A, g), o.reader.readAsDataURL(e);
                    },
                    abortHandler: function() {
                        var A = C;
                        A.reader && A.reader.abort();
                    }
                };
                A(e.file, function(A) {
                    nA.info("fileMd5: " + A), e.fileMd5 = A, C.init(e, o, i), C.upload();
                }, i);
            };
        }();
        o.SESSION_TYPE = Q, o.MSG_MAX_LENGTH = s, o.C2C_MSG_SUB_TYPE = h, o.GROUP_MSG_SUB_TYPE = l, 
        o.MSG_ELEMENT_TYPE = w, o.GROUP_TIP_TYPE = S, o.IMAGE_TYPE = r, o.GROUP_SYSTEM_TYPE = U, 
        o.FRIEND_NOTICE_TYPE = O, o.GROUP_TIP_MODIFY_GROUP_INFO_TYPE = K, o.BROWSER_INFO = E, 
        o.Emotions = o.EmotionPicData = EA, o.EmotionDataIndexs = o.EmotionPicDataIndex = gA, 
        o.TLS_ERROR_CODE = J, o.CONNECTION_STATUS = Y, o.UPLOAD_PIC_BUSSINESS_TYPE = m, 
        o.RECENT_CONTACT_TYPE = B, o.UPLOAD_RES_TYPE = a, o.Tool = IA, o.Log = nA, o.Msg = Ue, 
        o.Session = Se, o.MsgStore = {
            sessMap: function() {
                return Oe.sessMap();
            },
            sessCount: function() {
                return Oe.sessCount();
            },
            sessByTypeId: function(A, e) {
                return Oe.sessByTypeId(A, e);
            },
            delSessByTypeId: function(A, e) {
                return Oe.delSessByTypeId(A, e);
            },
            resetCookieAndSyncFlag: function() {
                return Oe.resetCookieAndSyncFlag();
            }
        }, o.Resources = CA, o.login = o.init = function(A, e, o, i, C) {
            Re.init(e.onConnNotify, i, C), e.jsonpCallback && (z = e.jsonpCallback), hA(A, e, o, i, C);
        }, o.logout = o.offline = function(A, e) {
            return RA("instance", A, e);
        }, o.logoutAll = function(A, e) {
            return RA("all", A, e);
        }, o.sendMsg = function(A, e, o) {
            return pe.sendMsg(A, e, o);
        }, o.syncMsgs = function(A, e) {
            return pe.syncMsgs(A, e);
        }, o.getC2CHistoryMsgs = function(A, e, o) {
            return pe.getC2CHistoryMsgs(A, e, o);
        }, o.syncGroupMsgs = function(A, e, o) {
            return pe.syncGroupMsgs(A, e, o);
        }, o.c2CMsgReaded = function(A, e, o) {
            return Oe.c2CMsgReaded(A, e, o);
        }, o.groupMsgReaded = function(A, e, o) {
            return ge(A, e, o);
        }, o.setAutoRead = function(A, e, o) {
            return Oe.setAutoRead(A, e, o);
        }, o.createGroup = function(A, e, o) {
            return mA(A, e, o);
        }, o.createGroupHigh = function(A, e, o) {
            return kA(A, e, o);
        }, o.applyJoinGroup = function(A, e, o) {
            return dA(A, e, o);
        }, o.handleApplyJoinGroupPendency = function(A, e, o) {
            return LA(A, e, o);
        }, o.getPendencyGroup = function(A, e, o) {
            return yA(A, e, o);
        }, o.getPendencyGroupRead = function(A, e, o) {
            return TA(A, e, o);
        }, o.handleInviteJoinGroupRequest = function(A, e, o) {
            return vA(A, e, o);
        }, o.deleteApplyJoinGroupPendency = function(A, e, o) {
            return JA(A, e, o);
        }, o.quitGroup = function(A, e, o) {
            return xA(A, e, o);
        }, o.searchGroupByName = function(A, e, o) {
            return zA(A, e, o);
        }, o.getGroupPublicInfo = function(A, e, o) {
            return WA(A, e, o);
        }, o.getGroupInfo = function(A, e, o) {
            return bA(A, e, o);
        }, o.modifyGroupBaseInfo = function(A, e, o) {
            return NA(A, e, o);
        }, o.getGroupMemberInfo = function(A, e, o) {
            return qA(A, e, o);
        }, o.addGroupMember = function(A, e, o) {
            return VA(A, e, o);
        }, o.modifyGroupMember = function(A, e, o) {
            return ZA(A, e, o);
        }, o.deleteGroupMember = function(A, e, o) {
            return XA(A, e, o);
        }, o.destroyGroup = function(A, e, o) {
            return _A(A, e, o);
        }, o.changeGroupOwner = function(A, e, o) {
            return $A(A, e, o);
        }, o.getJoinedGroupListHigh = function(A, e, o) {
            return Ae(A, e, o);
        }, o.getRoleInGroup = function(A, e, o) {
            return ee(A, e, o);
        }, o.forbidSendMsg = function(A, e, o) {
            return oe(A, e, o);
        }, o.sendCustomGroupNotify = function(A, e, o) {
            return ie(A, e, o);
        }, o.applyJoinBigGroup = function(A, e, o) {
            return HA(A, e, o);
        }, o.quitBigGroup = function(A, e, o) {
            return jA(A, e, o);
        }, o.getProfilePortrait = function(A, e, o) {
            return re(A, e, o);
        }, o.setProfilePortrait = function(A, e, o) {
            return De(A, e, o);
        }, o.applyAddFriend = function(A, e, o) {
            return Ie(A, e, o);
        }, o.getPendency = function(A, e, o) {
            return Qe(A, e, o);
        }, o.getPendencyReport = function(A, e, o) {
            return Be(A, e, o);
        }, o.deletePendency = function(A, e, o) {
            return se(A, e, o);
        }, o.responseFriend = function(A, e, o) {
            return Me(A, e, o);
        }, o.getAllFriend = function(A, e, o) {
            return we(A, e, o);
        }, o.deleteChat = function(A, e, o) {
            return te(A, e, o);
        }, o.deleteFriend = function(A, e, o) {
            return ne(A, e, o);
        }, o.addBlackList = function(A, e, o) {
            return fe(A, e, o);
        }, o.deleteBlackList = function(A, e, o) {
            return ce(A, e, o);
        }, o.getBlackList = function(A, e, o) {
            return Pe(A, e, o);
        }, o.getRecentContactList = function(A, e, o) {
            return ae(A, e, o);
        }, o.uploadFile = o.uploadPic = function(A, e, o) {
            return Je.uploadFile(A, e, o);
        }, o.submitUploadFileForm = function(A, e, o) {
            return Je.submitUploadFileForm(A, e, o);
        }, o.uploadFileByBase64 = o.uploadPicByBase64 = function(A, e, o) {
            var i = {
                To_Account: A.toAccount,
                Busi_Id: A.businessType,
                File_Type: A.File_Type,
                File_Str_Md5: A.fileMd5,
                PkgFlag: f.BASE64_DATA,
                File_Size: A.totalSize,
                Slice_Offset: 0,
                Slice_Size: A.totalSize,
                Slice_Data: A.base64Str,
                Seq: QA(),
                Timestamp: tA(),
                Random: BA()
            };
            return Ge(i, e, o);
        }, o.setJsonpLastRspData = function(A) {
            j = "string" == typeof A ? JSON.parse(A) : A;
        }, o.getLongPollingId = function(A, e, o) {
            return Fe(0, e, o);
        }, o.applyDownload = function(A, e, o) {
            return le(A, e, o);
        }, o.onDownFile = function(A) {
            window.open(CA.downloadMap["uuid_" + A]);
        }, o.checkLogin = function(A, e) {
            return rA(A, e);
        };
    }(o), o;
}();